问题描述
开展以deviceready事件的应用程序后,在Android上的PhoneGap我的应用程序返回false screen.width(window.innerWidth是一样的),中兴通讯刀片(原生800px)值。我问多次时,你得到的宽度值,例如320,533或787像素,有时不同的价值观在一个应用程序实例(发射)...
After launching app with "deviceready" event, my Phonegap app on Android returns false screen.width (window.innerWidth is the same) values on ZTE Blade (native 800px). I get width values like 320, 533 or 787 px, sometimes different values within one app instance (launch) when asking multiple times...
我的android:在我的AndroidManifest.xml screenOrientation =风景。在Eclipse中使用的PhoneGap /科尔多瓦1.8.1(蓝色)。
I have android:screenOrientation="landscape" in my AndroidManifest.xml. Using Phonegap/Cordova 1.8.1 in Eclipse (Indigo).
screen.width的一些样本值:
Some sample values of screen.width:
index.html中
in index.html
- 在之前document.addEventListener +deviceready:320
- 在刚结束deviceready:320
然后重定向,因为2闪屏的三倍(改变了window.location不同的HTML文件),最后降落到main.html中。我有我的.js code在短短用于调试的每个文件,并获得3 console.logs:
then redirect three times (change window.location to different HTML file) because of 2 splash-screens and finally land to main.html. I include my .js code in every file just for debugging, and get 3 console.logs:
- 320
- 787
- 787
很奇怪......
推荐答案
还有一个COM prehensive文章(+不同的值比较表),你应该阅读:的
There's a comprehensive article (+ comparison tables of different values) that you should read: http://tripleodeon.com/2011/12/first-understand-your-screen/
希望这有助于你的问题。
Hope this helps with your issue.
这篇关于的JavaScript + PhoneGap的+安卓screen.width返回坏的(几乎是随机的)值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!