Android 同时加载多个webview 加载很慢解决方式

    现在做的是平板的项目,需要在主界面同时显示webview,服务器有数据来,需要同时更新加载图形的数据,在低配置的手机上运行会使界面卡住,
在三星平板或者手机上运行还算流畅,经过排除,确定是因为webview的加载过慢导致界面卡顿,所以需要优化webview的加载速度,谷歌了一下,找到以下方法:
1.翻译一下英文大概的意思就是:设置渲染等级为高等、设置为硬件加速、不要有缓存数据


It depends on the web application being loaded. Try some of the approaches below:
Set higher render priority (deprecated from API 18+):
        webview.getSettings().setRenderPriority(RenderPriority.HIGH);
Enable/disable hardware acceleration:
four_chart_webview.getSettings().setRenderPriority(RenderPriority.HIGH);
four_chart_webview.getSettings()
.setCacheMode(WebSettings.LOAD_NO_CACHE);
if (Build.VERSION.SDK_INT >= 11) {
four_chart_webview.setLayerType(View.LAYER_TYPE_SOFTWARE, null);


} else {
four_chart_webview.setLayerType(View.LAYER_TYPE_HARDWARE, null);
}


2.还有一种是在主配置文件manifest中设置整个应用程序启动硬件加速,大概翻译的意思就是这样:


Adding this?android:hardwareAccelerated="true"?in the manifest was the only thing that significantly improved the performance for me

上述的硬件加速true和false我在手机上没有什么感觉
以下是问答的全文:http://stackoverflow.com/questions/7422427/android-webview-slow
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值