如何优化renderspeed android的web视图 [英] how to optimize renderspeed in android webview

查看:165
本文介绍了如何优化renderspeed android的web视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能加强在web视图渲染速度?用一个简单的innerHTML需要接近1秒显示的内容虽然JS渲染需要几毫秒。与iOS如出一辙code为迅速而完美地运行,甚至更少的高性能硬件。

Is there a possibility to enhance the rendering speed in webview? With a simple innerHTML it takes close to 1 sec to display the content although the js rendering takes a few ms. With IOS, exactly the same code is running swiftly and perfectly, even with less performant hardware.

安卓下进行测试:2.3,3.2,4.0(Desire HD的,Galaxy Nexus的,Galaxy Tab的) IOS:4,5(iPhone的3GS,4)

Tested under Android: 2.3, 3.2, 4.0 (Desire HD, Galaxy Nexus, Galaxy Tab) IOS: 4, 5 (iPhones 3gs, 4)

鸭preciate任何有帮助的答复!

Appreciate any helpful responses!

推荐答案

有一些事情你可以试试:

There are a few things you can try:

  • 中加入安卓开启硬件加速:hardwareAccelerated =真正的在Android清单文件的应用程序或活动的标记。更多资讯:<一href="http://developer.android.com/guide/topics/graphics/hardware-accel.html">http://developer.android.com/guide/topics/graphics/hardware-accel.html

  • Turn on hardware acceleration by adding android:hardwareAccelerated="true" to the application or activity tag in the Android manifest file. More info here: http://developer.android.com/guide/topics/graphics/hardware-accel.html

修改的WebView的RenderPriority - <一个href="http://developer.android.com/reference/android/webkit/WebSettings.RenderPriority.html">http://developer.android.com/reference/android/webkit/WebSettings.RenderPriority.html

Modify the RenderPriority of the webview - http://developer.android.com/reference/android/webkit/WebSettings.RenderPriority.html

优化JavaScript和CSS,以尽量减少回流的数量,内存使用,和DOM大小 - <一个href="http://www.html5rocks.com/en/mobile/mobifying.html#toc-optimizations">http://www.html5rocks.com/en/mobile/mobifying.html#toc-optimizations

Optimize your javaScript and CSS to minimize the number of reflows, memory used, and DOM size - http://www.html5rocks.com/en/mobile/mobifying.html#toc-optimizations

就个人而言,我发现,保持DOM尽可能小,并支持硬件加速使所有的差异无法使用的应用程序之间,并且速度相当流畅的应用程序。

Personally, I found that keeping the DOM as small as possible, and enabling hardware acceleration made all of the difference between an unusable app, and a fairly smooth app.

这篇关于如何优化renderspeed android的web视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆