WebView loaddata中文乱码

来源:互联网 发布:电脑抢票软件 编辑:程序博客网 时间:2024/05/20 09:08
如果单纯显示文字的话可以写webView.loadDataWithBaseURL(null, string, "text/html","utf-8", null);
如果要显示图片可以写webView.loadDataWithBaseURL(baseUrl, string, "text/html","utf-8", null);
其中baseUrl为你存储照片的路径,比如:
String baseUrl="file:///sdcard/images/photo/";
若加载html内容包含图片的话
.loadDataWithBaseURL(baseUrl, string, "text/html", "utf-8",null);
baseUrl  替换成你的网站根路径
0 0
原创粉丝点击