I've written an app which contains a large textview for displaying notes. Is it possible to have the textview highlight any phone numbers or hyperlinks without underlining the entire view?
You can define the underlined text in an Android layout XML using a String Resouce XML file. In a string res file you have to use an HTML underline tag <u> </u> .
You can make a phone number a clickable link that opens a dial dialog on smartphones and mobile devices. To get started, highlight the number and click the Link button. Next, change the Protocol to <other> and paste the phone number into the URL box, with the prefix "tel:+" as shown below. Click OK when finished.
tvSubmit. setMovementMethod(LinkMovementMethod. getInstance()); Spannable sp = (Spannable) tvSubmit. getText(); ClickableSpan click = new ClickableSpan() { @Override public void onClick(View widget) { showLink(); } }; sp.
<TextView ... android:autoLink="all" />
That's actually enough for you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With