1

I have a link inside a Textview, when i'd clicked it work(open the link) but do not highlight color arround the link before open.

that's my code:

text.setText(Html.fromHtml("<a href='http://google.com'>Google</a> example of link");
Kiko Mesquita
  • 457
  • 1
  • 3
  • 9

3 Answers3

0

This should work.

textView.setText(Html.fromHtml("<a href=\"http://www.google.com\">This is a link</a>"));
textView.setMovementMethod(LinkMovementMethod.getInstance());

From Gunnar 's solution.

Community
  • 1
  • 1
Naskov
  • 4,121
  • 5
  • 38
  • 62
0

Add this line to make it work -

htmlContent.setMovementMethod(LinkMovementMethod.getInstance());
A J
  • 4,542
  • 5
  • 50
  • 80
0

You can try to use android:textColorHighlight="yourColorHere" on your TextView

artenson.art98
  • 1,543
  • 15
  • 15