今天遇到解析json的时候html是String类型的,如下是解决方法:
webView = (WebView) findViewById(R.id.bbs_webview);
webView.getSettings().setJavaScriptEnabled(true);
special_content = special_content.replaceAll("&", "");
special_content = special_content.replaceAll(""", "\"");
special_content = special_content.replaceAll("<", "<");
special_content = special_content.replaceAll(">", ">");
special_content = special_content.replaceAll("\\n", "<br>");//换行
special_content = special_content.replaceAll("<img", "<img width=\"100%\"");//图片不超出屏幕
webView.loadDataWithBaseURL(null, special_content, "text/html", "utf-8", null);
webView = (WebView) findViewById(R.id.bbs_webview);
webView.getSettings().setJavaScriptEnabled(true);
special_content = special_content.replaceAll("&", "");
special_content = special_content.replaceAll(""", "\"");
special_content = special_content.replaceAll("<", "<");
special_content = special_content.replaceAll(">", ">");
special_content = special_content.replaceAll("\\n", "<br>");//换行
special_content = special_content.replaceAll("<img", "<img width=\"100%\"");//图片不超出屏幕
webView.loadDataWithBaseURL(null, special_content, "text/html", "utf-8", null);