1
嘗試呈現從webservice傳遞的html以使用loadData/loadDataWithBaseURL顯示在webView中。Webview loadDataWithBaseURL不顯示html android
我已經編碼了html字符串TextUtils.htmlEncode並將其包裝在<html> <body>但是沒有任何顯示。
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);
omg!完全錯過了我的html文本是白色的事實,謝謝 – scottyab 2011-05-04 15:41:30