Hyperlink in textview not showing link around text in Android -
Hyperlink in textview not showing link around text in Android -
i want show link text in textview address come in in anchor tag android. tried next code till output.
textview xml layout:
<textview android:id="@+id/test" android:layout_width="wrap_content" android:layout_height="wrap_content" android:autolink="web" android:linksclickable="true" android:textsize="22sp" /> textview java code:
private string tweet="<a href=http://www.google.co.in>google</a>"; test = (textview) findviewbyid(r.id.test); test.settext(html.fromhtml(tweet)); test.setmovementmethod(linkmovementmethod.getinstance()); it should show google , on clicking should open.
the string tweet must contain real html code, not escaped tags. additionally, improve surround attributes quotes: (need escaped)
so line:
private string tweet="<a href=http://www.google.co.in>google</a>"; has changed this:
private string tweet="<a href=\"http://www.google.co.in\">google</a>"; you need remove android:autolink="web" , android:linksclickable="true":
<textview android:id="@+id/test" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textsize="22sp" /> android textview
Comments
Post a Comment