[英]screen.width return wrong size javascript android
I am writing 1 app use phonegap. 我正在编写1个应用程序使用phonegap。
I use screen.width and .height to get screen width and height. 我使用screen.width和.height来获取屏幕的宽度和高度。
But when i test, is return wrong value. 但是当我测试时,返回错误的值。 This is some device and simulator i tested: 这是我测试过的一些设备和模拟器:
Samsung galaxy mini 2.3.4 (240x320): return random in (240x301) and (320x401)
Panasonic 102p 2.3.5 (540x960): return random in (0x0) and (320x622) and (540x922)
work perfect in simulator mobile and table run android 4.0.1 在模拟器移动和表运行android 4.0.1中完美工作
HTC ONE X android 4.1.1 (720x1280): work perfect
After some test, i think it wrong because android 2. 经过一些测试,我认为这是错误的,因为android 2。
I tried: 我试过了:
screen.width (height)
screen.availWidth (height)
window.innerWidth (height)
$(window).width() (height)
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="8" />
I use the next code and works well. 我使用下一个代码,效果很好。
var windowWidth = $(window).width();
var windowHeight = $(window).height();
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="10" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.