我有一个WebView巫婆呈现HTML字符串,它在模拟器上工作正常,但在实际设备上却不行。
fun WebView.loadData(content: String,
textColor: String = "black",
backgroundColor: String = "white",
mimeType: String = "text/html",
encoding: String = "utf-8") {
this.loadData(getHtmlLayout(content, textColor, backgroundColor), mimeType, encoding)
}
webViewFragment.settings.javaScriptEnabled = true
webViewFragment.loadData(content)
查看堆栈跟踪,有一些我不确定是否相关的消息:
I/chromium: [INFO:CONSOLE(0)] "Using unescaped '#' characters in a data URI body is deprecated and will be removed in M71, around December 2018. Please use '%23' instead. See https://www.chromestatus.com/features/5656049583390720 for more details.", source: (0)
答案 0 :(得分:0)
很奇怪,看来浏览器不再支持'#'了,在我的HTML内容中,我有一个十六进制颜色#dd5f11
的女巫引起了这个问题,在删除了red
这样的文字颜色后,它已修复