I couldn't figure it out, but finally it started working when I did something like:
tvTermsOfUse.setText(Html.fromHtml(getString(R.string.tv_terms_of_use_html)));
Linkify.addLinks(tvTermsOfUse, Linkify.ALL);
tvTermsOfUse.setMovementMethod(LinkMovementMethod.getInstance());
Text view looks like:
<TextView
android:id="@+id/tv_terms_of_use"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:textAlignment="gravity"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="15sp" />
and string res:
<string name="tv_terms_of_use_html">
<![CDATA[This is link to <a href="http://google.com/">Google</a>.]]>
</string>
Important part:
The Linkify.addLinks
has to be done before tvTermsOfUse.setMovementMethod
, otherwise it won't work.
No other settings are necessary in XML.
It took me around hour to figure it out myself, hope it helps someone.
EDIT:
According to @rfellons comment
Thanks. Also for me works ... BUT only with
<uses-permission android:name="android.permission.INTERNET"/>
on Manifest.xml. –
rfellons Sep 7 at 13:31
Make sure you check it as well.