问题描述
- WebView显示不全,有时候正常,有时候不正常
-
WEbView加载数据的时候,有时候显示正常,有时候显示不正常,如图,请大神帮忙解决下,代码如下:mNewsDocWeb = (WebView) findViewById(R.id.wb_news_doc_info);
mNewsDocWeb.getSettings().setJavaScriptEnabled(true);
mNewsDocWeb.getSettings().setLayoutAlgorithm(
LayoutAlgorithm.NARROW_COLUMNS);
mNewsDocWeb.getSettings().setUseWideViewPort(true);
mNewsDocWeb.getSettings().setLoadWithOverviewMode(true);
mNewsDocWeb.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
mNewsDocWeb.setWebChromeClient(new WebChromeClient());
mNewsDocWeb.loadUrl(webUrl);mNewsDocWeb.setWebViewClient(new mNewsWebClient());
mNewsDocWeb.addJavascriptInterface(this, "news");<?xml version="1.0" encoding="utf-8"?>
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/act_default"
android:orientation="vertical" ><include layout="@layout/title_layout" /> <WebView android:id="@+id/wb_news_doc_info" android:layout_width="match_parent" android:layout_height="match_parent" android:layerType="hardware" />
解决方案
setCacheMode设置有误!
时间: 2025-01-30 16:50:05