Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android文本视图可点击<;a href/>;标记并链接到浏览器_Android_Kotlin_Android Webview - Fatal编程技术网

Android文本视图可点击<;a href/>;标记并链接到浏览器

Android文本视图可点击<;a href/>;标记并链接到浏览器,android,kotlin,android-webview,Android,Kotlin,Android Webview,当然,我知道这个问题会重复其他问题。我尝试过这方面的研究;然而,这是不正确的,即使我遵循比 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 {

当然,我知道这个问题会重复其他问题。我尝试过这方面的研究;然而,这是不正确的,即使我遵循比

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)
我也把它拿走了

android:autoLink="web"
因为肯定的是,自动链接不适合这种情况

经允许,我已经添加了

<uses-permission android:name="android.permission.INTERNET" />
和内部strings.xml

<string name = "google"> go to <a href = "www.google.com" >google</a></string>
转到
我希望这对你有帮助D

虽然它的java版本,但应该可以工作。尝试使用标志Html.FROM_Html\u MODE\u LEGACY而不是Html.FROM_Html\u MODE\u COMPACT

text_view.setText(R.string.google)
text_view.movementMethod = LinkMovementMethod.getInstance()
<string name = "google"> go to <a href = "www.google.com" >google</a></string>