webView.loadDataWithBaseURL(null,setWebVIewImage(message), "text/html", "UTF-8", null);
// 适配image和table标签
public static String setWebVIewImage(String star) {
String head = "<head>"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\"> "
+ "<style>img{max-width: 100%; width:auto; height:auto;}</style>"
+ "<style>table{max-width: 100%; width:auto; height:auto;}</style>"
+ "</head>";
return "<html>" + head + "<body>" + star + "</body></html>";
}
webView加载富文本,内容适配屏幕
猜你喜欢
转载自blog.csdn.net/qq_26075861/article/details/102861377
今日推荐
周排行