Webview loadDataWithBaseURL not displaying html android
Trying to render html which is passed from a webservice to display in a webView using the loadData/loadDataWithBaseURL.
I've encoded the html string TextUtils.htmlEncode and wrapped it in <html> <body> but nothing is displayed.
mMessageDetailsHtmlString = <html><body><div style="colo开发者_JAVA技巧r:#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);
Looks the text in that html is white, is your webview's background white too by any chance?
Try mWebView.setBackgroundColor(Color.BLUE);
精彩评论