科尔多瓦android滚动/性能问题 [英] Cordova android scrolling/performance issues

查看:95
本文介绍了科尔多瓦android滚动/性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下CSS为我的Cordova应用创建平滑滚动

I use the following CSS to create smooth scrolling for my Cordova app

.scrollable { 
    overflow: auto;
    -webkit-transition-property: top, bottom;
    transition-property: top, bottom;
    -webkit-transition-duration: .2s, .2s;
    transition-duration: .2s, .2s;
    -webkit-transition-timing-function: linear, linear;
    transition-timing-function: linear, linear;
    -webkit-overflow-scrolling: touch;
    -webkit-transform: translateZ(0);
    -webkit-backface-visibility: hidden;
}

这在iOS上效果很好,但由于某种原因在Android上却没那么出色. Android的整体性能也不接近iOS,但在滚动时最明显.有什么建议?我打开了android:hardwareAccelerated="true",但这似乎并没有太大的区别.

This works wonderfully on iOS, but for some reason on Android not so much. Overall performance with Android isn't close to what iOS is either, but it is most noticeable when scrolling. Any suggestions? I have android:hardwareAccelerated="true" on, but that doesn't seem to make much of a difference.

推荐答案

Android浏览器滚动总是很麻烦,其性能比iOS差很多.这就是像Ionic这样的混合应用程序框架向Android引入了原生滚动的原因性能要好得多. Ionic确实很麻烦,但是如果您不想使用它,则可以做一些Google搜索来查找有关android native滚动的更多信息,或者

Android browser scrolling is always a pain, the performance is much worse than iOS. That's why hybrid app frameworks like Ionic has introduced native scrolling to android, which makes the performance much better. Ionic really rocks, but if you don't want to use it, you may do some Googling to find out more information about android native scrolling, or read its source code to find out how they achieved it and port it to your project.

解决此问题的另一种方法是将 Crosswalk 嵌入到您的android应用中,这是基于Chromium的webview.缺点是APK的大小会增加20MB,但是在不同版本的Android OS上的性能和一致性确实会改善很多.

Another way to solve this problem is to embed Crosswalk to your android app, it's a Chromium based webview. The downside is that the size of your APK will increase by 20MB, but performance and consistency on different versions of Android OS will really improve a lot.

这篇关于科尔多瓦android滚动/性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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