Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/329.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
Java Android通过TextView链接显示html字符串_Java_Android_Html_Textview - Fatal编程技术网

Java Android通过TextView链接显示html字符串

Java Android通过TextView链接显示html字符串,java,android,html,textview,Java,Android,Html,Textview,我想创建一个android链接(具有特定名称),在本地web浏览器中显示给定的html字符串。我需要使用TextView,但它似乎不起作用 这就是我从日志中得到的: 找不到intent的URLSpan:ACTIVITY,intent{act=android.intent.action.VIEW dat=这是html字符串 代码如下: link=“” +链接名称+“” TextView名称=((TextView)findViewById(relevent_int)) 我假设您想浏览到某个网站,因此

我想创建一个android链接(具有特定名称),在本地web浏览器中显示给定的html字符串。我需要使用TextView,但它似乎不起作用

这就是我从日志中得到的:

找不到intent的URLSpan:ACTIVITY,intent{act=android.intent.action.VIEW dat=这是html字符串

代码如下:

link=“” +链接名称+“”

TextView名称=((TextView)findViewById(relevent_int))


我假设您想浏览到某个网站,因此请确保URL格式正确”http://whatever“或”https://whatever“。以下是一个例子:

val urlString = "https://stackoverflow.com"
val link_name = "Stack Overflow"
val link = "This is the link: <a href=\"" + urlString + "\">" + link_name + "</>"
val urlString=”https://stackoverflow.com"
val link_name=“堆栈溢出”
val link=“这是链接:“+link\u name+”
这将浏览到堆栈溢出。如果仍有问题,请检查调试器中的URL,确保其格式正确

val urlString = "https://stackoverflow.com"
val link_name = "Stack Overflow"
val link = "This is the link: <a href=\"" + urlString + "\">" + link_name + "</>"