android webview设置和遇到的坑
WebSettings webSettings = webView.getSettings(); webSettings.setCacheMode(webSettings.LOAD_NO_CACHE);//设置不缓存 webSettings.setJavaScriptEnabled(true); //支持JS if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW); } webView.setInitialScale(50);//设置显示的缩放比例
String URL = "http://192.168.3.23:8082/#/bigScreen?id=123456"; webView.loadUrl(URL);
//加载页面需要设置谷歌浏览器内核 webView.setWebChromeClient(new WebChromeClient() { @Override public void onReceivedTitle(WebView view, String title) { super.onReceivedTitle(view, title); } @Override public void onProgressChanged(WebView view, int newProgress) { super.onProgressChanged(view, newProgress); if (newProgress == 100) { } } });