WebView加载HTML格式网页

版权声明:本文为博主原创文章,转载请注明出处! https://blog.csdn.net/JavaAndroid730/article/details/71286384

WebSettings settings = myWebView.getSettings();
//不显示webview缩放按钮
settings.setDisplayZoomControls(false);
settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //优先使用缓存
settings.setJavaScriptEnabled(true); //启动js功能 (json)
settings.setBuiltInZoomControls(true); //显示放大缩小按钮(不支持已经适配好移动端的页面)
settings.setUseWideViewPort(true); //双击缩放(不支持已经适配好移动端的页面)
settings.setTextSize(WebSettings.TextSize.NORMAL); //文字大小
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);//图片大小
settings.setUseWideViewPort(false);
settings.setLoadWithOverviewMode(true);
myWebView.loadDataWithBaseURL(null,“这里填HTML格式的数据”, “text/html”, “utf-8”, null);

猜你喜欢

转载自blog.csdn.net/JavaAndroid730/article/details/71286384