简体   繁体   English

PhoneGap / Android应用程序上的黑屏

[英]Blank screen on PhoneGap/Android application

I'm struggling with a Phonegap-Android application. 我在为Phonegap-Android应用程序苦苦挣扎。 I'm using jQuery Mobile 1.3.1 and jQuery 1.9.1, with Phonegap 2.9.0. 我正在使用带Phonegap 2.9.0的jQuery Mobile 1.3.1和jQuery 1.9.1。 I've got some data-role pages in my index.html and I'm generating some other dynamically with an ajax function. 我的index.html中有一些数据角色页面,并且正在使用ajax函数动态生成其他一些页面。 The problem is that always, after showing a dynamically generated page the screen goes all white. 问题在于,总是在显示动态生成的页面后屏幕变成全白。 This never happens if I navigate between pages statically created in the index.html. 如果我在index.html中静态创建的页面之间导航,这永远不会发生。

Any suggestions? 有什么建议么? I've tried with: 我尝试过:

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

  • CSS: .ui-page { -webkit-transform: translateZ(0); CSS:.ui-page {-webkit-transform:translateZ(0); -webkit-perspective:1000; -webkit-perspective:1000; -webkit-backface-visibility: hidden; -webkit-backface-visibility:隐藏; -msie-backface-visibility: hidden; -msie-backface-visibility:隐藏; -ms-backface-visibility: hidden; -ms-backface-visibility:隐藏; } }

  • defaultPageTransition = "none" defaultPageTransition =“无”

The new pages are created using Mustache.js. 新页面是使用Mustache.js创建的。

Something to quickly try would be to globally enable DOM caching in jQuery Mobile: 快速尝试的方法是在jQuery Mobile中全局启用DOM缓存:

$.mobile.page.prototype.options.domCache = true;

or 要么

pageContainerElement.page({ domCache: true });

I would say it stems from a given page not containing the dynamically generated markup, which you need in order to utilize jQM's ajax navigation... which uses it's own internal history tracking object to fuel the hashchange and/or popstate event. 我要说的是,它来自不包含动态生成的标记的给定页面,您需要利用它来利用jQM的ajax导航...使用其自身的内部历史跟踪对象来推动hashchange和/或popstate事件。

Beyond that, I would step through how the dynamic pages are actually being added to the DOM. 除此之外,我将逐步介绍如何将动态页面实际添加到DOM。 You should be able to keep using Mustache's template plugin, but you'll have to make sure to use the jQM to add the markup to the DOM. 您应该能够继续使用Mustache的模板插件,但是必须确保使用jQM将标记添加到DOM。 (Or go through a potentially long process of creating overrides... which I think you should avoid if possible.) (或者经历一个漫长的创建覆盖的过程...我认为,如果可能,应避免这样做。)

When you use jQM to update the DOM, it ensures the correct events fire and in the correct order, thus keeping the app data/state up-to-date. 当您使用jQM更新DOM时,它可确保触发正确的事件并按正确的顺序进行,从而使应用程序数据/状态保持最新。

I'm sure you're using the documentation, but I would give this another look. 我确定您使用的是文档,但我会再看一遍。 Might give you a better idea on what Mustache method you need to stop using, or extend/override. 可能会让您更好地了解停止使用或扩展/覆盖所需的哪种Mustache方法。

Hope this helps. 希望这可以帮助。

jQM References jQM参考

DOM Caching: http://view.jquerymobile.com/1.3.1/dist/demos/#nav-cache DOM缓存: http : //view.jquerymobile.com/1.3.1/dist/demos/#nav-cache

Navigation Event: http://view.jquerymobile.com/1.3.1/dist/demos/widgets/navigation/#nav-event-example 导航事件: http//view.jquerymobile.com/1.3.1/dist/demos/widgets/navigation/#nav-event-example

Dynamic Page Loading: http://jquerymobile.com/demos/1.3.1/docs/pages/page-dynamic.html 动态页面加载: http : //jquerymobile.com/demos/1.3.1/docs/pages/page-dynamic.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带JQuery的Ajax和带PhoneGap的Android应用程序 - Ajax with JQuery for Android Application with PhoneGap 如何在android phonegap应用程序中传递参数 - How to pass parameters in android phonegap application ajax调用在使用phonegap的android应用程序中不起作用 - ajax call not working in android application using phonegap Android Phonegap应用程序中的按钮单击事件错误 - Error On button click event in Android Phonegap application Android设备上的phonegap应用程序不发送AJAX请求 - The phonegap application on Android devices does not send AJAX requests jQuery的ajax功能在Android PhoneGap应用程序中不起作用 - jQuery's ajax function does not work in Android PhoneGap application Phonegap $ .ajax android解析器 - Phonegap $.ajax android parsererr 将android从2.3.3升级到4.0.3后,phonegap应用程序ajax调用失败 - phonegap application ajax calls fail after upgrading android from 2.3.3 to 4.0.3 无法使用ajax从Django后端将图像获取到phonegap android应用程序 - not able to get the image from django backend to phonegap android application using ajax Android上的Phonegap:在请求标头上设置接受:“ application / xml”时,AJAX请求失败 - Phonegap on Android: AJAX request fails when setting Accept: 'application/xml' on request header
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM