7

谁能告诉我 WebView 类中 loadData() 和 loadDataWithBaseURL() 之间的区别。

当我web.loadDataWithBaseURL("",html, mimetype, encoding,"");在我的程序中使用时,其中 html 是包含硬编码 html 标签的字符串,它的显示就像 html 页面一样,当我在代码中使用 loadData(html,mimetype,encoding) 时,应用程序正在关闭。

我阅读了 API 但无法理解......所以请帮助我......

提前致谢

4

1 回答 1

8

万一有人遇到这个, WebView.loadData 似乎被打破了:

http://code.google.com/p/android/issues/detail?id=1733#c23

http://code.google.com/p/android/issues/detail?id=3552

OP 问题中建议的解决方案的变体似乎是解决方法。我认为空值比“”便宜,所以我使用了这个:

web.loadDataWithBaseURL(null,html, "text/html", "utf-8",null);
于 2011-11-17T06:05:29.647 回答