Link html content to load it in webview
I am loading a string html
in webview
, and I want to link phone numbers, addresses and emails. But if I use Spannable
to pass content html
to a method Linkify.addLinks()
, all layouts html
break.
String htmlText = "<some_html></some_html>";
SpannableString spannableString = new SpannableString(Html.fromHtml(htmlText));
Linkify.addLinks(spannableString, Linkify.ALL);
htmlText = Html.toHtml(spannableString);
So how to link content html
before uploading it to webview
?
+3
AinisSK
source
to share
1 answer
In the TextView xml layout you must add the following:
android:autoLink="all"
android:linksClickable="true"
<a href="www.google.com">Google!</a>"
0
Ratilal Chopda
source
to share