如何优化renderspeed android的web视图视图、renderspeed、android、web

由网友(深情不如久伴)分享简介:是否有可能加强在web视图渲染速度?用一个简单的innerHTML需要接近1秒显示的内容虽然JS渲染需要几毫秒。与iOS如出一辙code为迅速而完美地运行,甚至更少的高性能硬件。Is there a possibility to enhance the rendering speed in webview? With...

是否有可能加强在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清单文件的应用程序或活动的标记。更多资讯: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 - 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大小 - 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.

阅读全文

相关推荐

最新文章