【问题标题】:Webview Android does'nt load whole content from a large html fileWebview Android 不会从大型 html 文件中加载全部内容
【发布时间】:2017-07-08 08:08:09
【问题描述】:

我有一个非常大的 html file(只有大约 10k 行文本)。当我使用 Webview 加载此 html 内容时,它仅显示大约数百个,剩余空间为空白(空白)。有人可以帮我解决这个问题吗?谢谢。 以下是我的代码:

WebView mWebView;
mWebView = (WebView) findViewById(R.id.activity_main_webview);

WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("file:///android_asset/test.html");//test.html in assets folder

我也尝试使用 webView.setLayerType(WebView.LAYER_TYPE_HARDWARE, null) 或 webView.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null) 但它没有帮助。

【问题讨论】:

    标签: android webview android-webview


    【解决方案1】:

    我刚刚找到了 Webview 问题的解决方案。 Webview 无法显示 html 文件的全部内容的原因是 html 构造不好,一些 html 标签如<abc@.com> 将不会被 Webview 读取。所以我将内容转换为正确的 html 格式,然后它就可以工作了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-04-11
      • 1970-01-01
      • 1970-01-01
      • 2014-08-15
      • 2015-11-16
      • 2020-01-16
      • 1970-01-01
      • 2019-04-24
      相关资源
      最近更新 更多