gpt4 book ai didi

java - WebView issue new update android 操作系统

转载 作者:行者123 更新时间:2023-11-29 18:35:35 25 4
gpt4 key购买 nike

最近一些设备停止工作 webview 组件,我检测到 android 8 和 android 6 或更低版本可以正常工作,但在 android 7 o 9 的设备中没有显示文本。这个问题是最近几周开始的。自 2018 年 2 月以来,我没有更新应用程序

descripcion = (WebView) findViewById(R.id.txt_descripcion);

String description="<html><body><head><style type=\"text/css\">\n" +
"p {\n" +
"font-size:90%;text-indent: 1em; text-align:justify; \n" +
"}\n" +"body {font-family: Arial, Helvetica, sans-serif;}\n" +
"\n" +
"table { font-family: \"Lucida Sans Unicode\", \"Lucida Grande\", Sans-Serif;\n" +
" font-size: 12px; width: 100%; text-align: left; border-collapse: collapse; }\n" +
"\n" +
"th { font-size: 13px; font-weight: normal; background: #b9c9fe;\n" +
" border-top: 4px solid #aabcfe; border-bottom: 1px solid #fff; color: #039; }\n" +
"\n" +
"td { background: #e8edff; border-bottom: 1px solid #fff;\n" +
" color: #669; border-top: 1px solid transparent; }\n" +
"\n" +
"tr:hover td { background: #d0dafd; color: #339; }"+
"</style></head><p>"+hechizo.getDescripcion()+"</p></body></html>";

descripcion.loadData(description,"text/html; charset=UTF-8",null);

最佳答案

试试这个:

WebSettings settings = myWebView.getSettings();
settings.setDefaultTextEncodingName("utf-8");
myWebView.loadDataWithBaseURL(null, htmlString, "text/html", "utf-8", null);

关于java - WebView issue new update android 操作系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54506084/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com