2013-02-06 71 views
11

我在Android平台(2.3.3及更高版本)上为我的应用程序使用PhoneGap 2.2.0与jQuery Mobile 1.2.0结合使用。 在页面上我使用固定标题,根本没有转换。休息几乎是标准的jQuery。Android上的JQM和PhoneGap闪烁/闪烁

当我在页面之间导航时,我会在短时间内眨眼(整个页面)。我在网上搜索了几个小时。

下面失败尝试:

当我在Android项目中关闭硬件加速时,闪烁消失。但是一些CSS样式出错了,总体性能非常糟糕(显然)。

我现在也尝试了下面的代码。

ui.page { 
-webkit-transform: translateZ(0); 
-webkit-perspective:1000; 
-webkit-backface-visibility: hidden; 
} 

不好还没有运气。

也试过这个:https://github.com/watusi/jquery.mobile.simultaneous-transitions 仍然是一个简短的(全白页)在转换之前闪烁。

它看起来好像和页面本身的动画转换没有任何关系,但是在卸载旧页面之后,在加载新页面之前就发生了一些奇怪的事情。

更新25-04-2013: 也试过: https://groups.google.com/forum/?fromgroups=#!topic/phonegap/EtZ2KwseKQ0 https://github.com/jquery/jquery-mobile/issues/4024 https://github.com/jquery/jquery-mobile/pull/4129

,使眨眼消失在去除fixedheader部分的唯一的事。然后它像黄油一样光滑,但我想念与面板兼容的标题。

还尝试了1页面模板(所有页面在一个文件中)。也没有帮助。

jQuery Mobile的1.3.1 的PhoneGap 2.5.0 的Android 4+ 设备: - 谷歌三星Galaxy Nexus的 - 三星Galaxy Tab 10.1(有问题,但没有任何设备更多) - 三星Galaxy Note的10.1

我已经在Github上提交现在的问题:https://github.com/jquery/jquery-mobile/issues/6031

回答

17

设置视用户可扩展=没有固定的问题对我来说:

变化

< meta name="viewport" content="width=device-width, initial-scale=1" /> 

< meta name="viewport" content="width=device-width, user-scalable=no" /> 
+0

修正了我的闪烁!谢谢。我将在jQuery Mobile Github上编辑该问题。 –

+0

你救了我的命! thnx很多 – colourtheweb

+0

是的!我从HTML5样板开始,并在其中设置“initial-scale = 1”#WIN的视口 – Red2678

1

third link在您的文章是我固定它一会儿回来时,我有这个问题。我还添加了-webkit-perspective:1000;闪烁是因为3D加速,被转换的页面的背面变得可见几分之一秒,使其看起来像闪烁。

编辑:看看this以及更多信息。

+0

感谢您的回答。我尝试了你的建议,但糟糕的一小眨眼继续留在应用程序:)。 –

0

确保在您的mobileinit方法存在此代码:

//initialize jQM 
$(document).on("mobileinit", function() { 
    //hack to fix android page transition flicking issue 
    if (navigator.userAgent.indexOf("Android") != -1){ 
     $.extend( $.mobile , { 
      defaultPageTransition: 'none' 
     }); 
    } 
}); 

另外:更改后的jquerymobile.js

// Make our transition handler the public default. 
$.mobile.defaultTransitionHandler = simultaneousHandler; 

//transition handler dictionary for 3rd party transitions 
$.mobile.transitionHandlers = { 
    "default": $.mobile.defaultTransitionHandler, 
    "sequential": sequentialHandler, 
    "simultaneous": simultaneousHandler 
}; 

也请让我知道你正在使用的Android设备的版本?

+0

嗨,我测试了一下。我已经默认将defaultPageTransition设置为none。我还编辑了jquerymobile文件的建议。我没工作。我注意到,对于1.3.1你的第三个建议已经是这样了。你的第二个建议确实不同,所以我尝试了。浏览页面之间仍然非常小。设备:Galaxy Nexus,运行Android 4.2.2 :)。 –

2

设置视用户可扩展=没有固定的问题me:

< meta name="viewport" content="width=device-width, user-scalable=no" /> 

Works的 jQuery Mobile的1.3.1 科尔多瓦2.8.0 在Nexus 4 /安卓4.2.2

0

我试图数十解决方案,但没有他们的工作,形成了我最好的方式为我解决这个眨眼,将de autohidesplashscreen属性设置为false,在前一页中显示splashscreen并将其隐藏在deviceready中的目标页面中。在某些转换中,我们将转换大约0.5秒 - 1秒,以避免spalshscreen眨眼。不是最好的解决方案,但为我们工作。