尝试使用loadData / loadDataWithBaseURL渲染从webservice传递到webView中的html。
我编写了html字符串TextUtils.htmlEncode并将其包装在< html>中<身体GT;但没有显示任何内容。
mMessageDetailsHtmlString = <html><body><div style="color:#ffffff" align="center"><h3>Test Promo</h3></div><p style="color:#ffffff">Here is some text about a great test promo.</p><p style="color:#ffffff"It includes an image (below) using a fully qualified URL<p><p style="color:#ffffff"><img href="http://myserver.com/media/images/img-logo.png" /></p><p style="color:#ffffff">This is a test message with white text</p></body></html>
//used loadDataWithBaseURL with a fake base url as loadData didn't work
mWebView.loadDataWithBaseURL("http://null", mMessageDetailsHtmlString, "text/html", "utf-8", null);
答案 0 :(得分:1)
看起来html中的文字是白色的,你的webview的背景是否也是白色的?
尝试mWebView.setBackgroundColor(Color.BLUE);