【问题标题】:Webview takes long time to load [closed]Webview需要很长时间才能加载[关闭]
【发布时间】:2013-05-28 09:22:35
【问题描述】:

我在我的应用程序中使用 webview。而且我发现除了在移动浏览器中打开的网页之外,加载网页需要很长时间。

有什么办法可以提高 webview 的加载速度???

【问题讨论】:

  • 没有代码怎么知道问题?
  • 我认为你没有正确阅读我的帖子。
  • 加载速度取决于内容及其结构。

标签: android webview android-webview


【解决方案1】:

android中的Laoding webview不仅取决于网速,它还会根据操作系统版本和配置从设备更改为设备, loadUrl(url) 是加载数据的唯一方法...如果互联网速度较慢,则将 html 文件保留在资产中并提供该路径(url)以加载文件...

【讨论】:

    【解决方案2】:

    试试 loadData 方法,可能会快一点。

    String sumry;
    
    ...//convert your file to a string and store in sumry variable
    
      webview.loadData(sumry, "text/html", null);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-24
      • 1970-01-01
      • 2021-07-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-15
      相关资源
      最近更新 更多