Surely, I knew that this question will duplicate of other questions. I have tried research about this; However it's not correct even I follow than.
var html_first = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.fromHtml("<a href='http://www.google.com'> here </a> ", Html.FROM_HTML_MODE_COMPACT)
} else {
Html.fromHtml("<a href='http://www.google.com'> here </a>" )
}
text_view.setText(html_first)
I try to set html to text at Above code. as I searched, they suggest me to add
text_view.isClickable = true
text_view.movementMethod = LinkMovementMethod.getInstance()
And also I removed
android:autoLink="web"
Cuz it's surely that autoLink is not fix with this condition.
with permission, I already added with
<uses-permission android:name="android.permission.INTERNET" />
Any idea with this cuz I cannot click here and link to browser Thank in advance. :D
ANSWER UPDATED
with this, I solved it by move html to use string.xml. so we no need html more.
text_view.setText(R.string.google)
text_view.movementMethod = LinkMovementMethod.getInstance()
and inside strings.xml
<string name = "google"> go to <a href = "www.google.com" >google</a></string>
I hope this help you. :D
答案 0 :(得分:1)
虽然它的java版本但应该可以工作。尝试使用标记 Html.FROM_HTML_MODE_LEGACY 而不是 Html.FROM_HTML_MODE_COMPACT 。