I am trying to make these links text clickable in TexView
.
String s = "<a href=\"https://google.com\">google</a> https://google.com";
textview.setText(Html.fromHtml(s));
I could not make both clickable at the same time.
This makes <a>
tag clickable
textview.setMovementMethod(LinkMovementMethod.getInstance());
This makes web link clickable
textview.setAutoLinkMask(Linkify.ALL);
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/txtCredits"
android:autoLink="web" android:id="@+id/infoTxtCredits"
android:layout_centerInParent="true"
android:linksClickable="true"></TextView>
<string name="txtCredits"><a href="http://www.google.com">Google</a></string>
you have to add android:autoLink="web" in our application
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.