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?mac=123456";//URL不能带mac关键字,切记! 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) { } } });
原文地址:https://www.cnblogs.com/cxf1992/p/11598695.html
时间: 2024-10-07 00:44:30