- WebView技巧
WebView启用相关配置
1
2
3
4
5
6
7
8
9
10
11wv = (WebView) findViewById(R.id.article_webwiew);
wv.getSettings().setSupportMultipleWindows(true);
wv.getSettings().setJavaScriptEnabled(true);
wv.setWebViewClient(new WebViewClient());
wv.setWebChromeClient(new WebChromeClient());
wv.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);//关闭缓存
wv.getSettings().setAllowFileAccess(true);//允许读取文件
wv.getSettings().setAllowContentAccess(true);
wv.getSettings().setSupportZoom(false);//禁止缩放
wv.getSettings().setDomStorageEnabled(true);//开启本地数据库储存
wv.getSettings().setDatabaseEnabled(true);
WebView 缩放
1 | wv.getSettings().setSupportZoom(true);//禁止缩放 |
WebView JSON数据替换为String
1 | webView = (WebView) findViewById(R.id.bbs_webview); |