TextView underlines phone number and hyperlink

I wrote an application that contains a large text image for displaying notes. Is it possible for the text to display any phone numbers or hyperlinks without underlining the entire presentation?

+26
android
Jun 11 '10 at 21:35
source share
2 answers
<TextView ... android:autoLink="all" /> 

It is really enough for you.

+57
Jun 11 '10 at 23:35
source share

You can use Linkify to convert phone numbers, URLs, etc. links that, when clicked on, launch the corresponding applications (Dialer, Browser, etc.).

If you used only underscore, without links, you can:

  • Mark text with HTML, especially <u>...</u> for underlining
  • Run this via Html.fromHtml() to get Spannable with your in-place formatting
  • Enter Spannable in TextView via setText()

Here is a list of HTML tags supported by Android 2.1 version of Html.fromHtml() . Please note that this is not officially documented anywhere, so your mileage may vary.

+11
Jun 11 2018-10-11T00:
source share



All Articles