private void setWebString(WebView webView, String content) {
StringBuilder sb = new StringBuilder();
sb.append("<html>");
sb.append("<head>");
sb.append("<title>欢迎您</title>");
sb.append("</head>");
sb.append("<body>");
//sb.append("<h2>欢迎您访问<a href=\"https://blog.csdn.net/qq_50272406?spm=1000.2115.3001.5343\">"+"安卓小白~的博客</a></h2>");
sb.append(content);
sb.append("</body>");
sb.append("</html>");
String text = sb.toString();
LogUtil.e("setWebString=" + text);
webView.loadDataWithBaseURL(null, text, "text/html", "utf-8", null);
}
Android WebView加载html 代码
最新推荐文章于 2024-06-15 11:15:55 发布