Android 使hf在WebView中可单击
我有此代码,我正在尝试将其设置为“此处”。可单击:Android 使hf在WebView中可单击,android,Android,我有此代码,我正在尝试将其设置为“此处”。可单击: // this is the html code in the file "<a href=\'https://secfirst.org/terms\'>here.</a>" //Load my html file webView.loadUrl("file:///android_res/drawable/terms.html"); 我知道错误是ERR\u FILE\u NOT\u FOUND,但这可能是因为u
// this is the html code in the file
"<a href=\'https://secfirst.org/terms\'>here.</a>"
//Load my html file
webView.loadUrl("file:///android_res/drawable/terms.html");
我知道错误是ERR\u FILE\u NOT\u FOUND
,但这可能是因为url不起作用。知道如何修复吗?更改:
"<a href=\'https://secfirst.org/terms\'>here.</a>"`
“”`
到
原因是html无效,因为双引号将被视为文本字符,而使用单引号的html的其余部分不需要在此处转义。因此,用单引号(
\'
)替换斜杠字符作为普通双引号(“
)可以解决这个问题。尝试将”
改为
@petey,效果很好。我需要一杯咖啡,呵呵,这是我们中最好的一个。
"<a href=\'https://secfirst.org/terms\'>here.</a>"`
<a href="https://secfirst.org/terms">here.</a>