简体   繁体   English

Phonegap Android的screen.height和screen.width返回黑色系统栏空间

[英]Phonegap Android screen.height and screen.width returning black system bar space

I develop apps with Phonegap for Android. 我使用适用于Android的Phonegap开发应用程序。

In some of those apps I use javascript to make some dynamic calculations and place elements on screen. 在其中一些应用中,我使用javascript进行了一些动态计算并将元素放置在屏幕上。

The app uses Fullscreen preference in config.xml 该应用程序在config.xml中使用全屏首选项

So far that has been working well, but today I noticed that one app content went behind the black android system bar at bottom (the one with the back button, etc). 到目前为止,它一直运行良好,但是今天我注意到,一个应用程序内容位于底部黑色的Android系统栏的后面(一个带有后退按钮的等等)。 And if I turn landscape, it also goes behind the bar. 而且,如果我转向景观,它也会落在后面。

Inspecting, I found that in landscape mode, for example, screen.width is returning 640 for my device, when before it used to return 620. So it looks like now it is including the system bar space? 检查时,我发现在横向模式下,例如我的设备的screen.width返回640,而以前它返回620。那么现在看起来它包括系统栏空间了吗?

How can I detect if the value includes the system bar space or not? 如何检测该值是否包含系统栏空间? And how can I know how much space the system bar takes? 我怎么知道系统栏占用多少空间?

The app behavior changed without recompiling it. 应用程序行为已更改,无需重新编译。 So something external affected its behavior. 因此,某些外部因素会影响其行为。 Some days ago, the phone had an Android update. 几天前,手机进行了Android更新。 Maybe it is related to this. 也许与此有关。

The phone is using Android 5.0.2. 手机使用的是Android 5.0.2。 After it upgraded to Android 5.0.2, it was working well. 升级到Android 5.0.2后,它运行良好。 Then there was another, smaller update but it did not change the Android version number. 然后是另一个较小的更新,但它没有更改Android版本号。 The device is Moto G. 设备是MotoG。

Thanks for any help on this. 感谢您对此的任何帮助。 I really need to be able to get the screen width and height without the space used by that system bar, as it had always been until now. 我确实需要能够获得屏幕宽度和高度,而无需使用该系统栏所占用的空间,因为到目前为止一直如此。

Do you still have this issue ? 你还有这个问题吗? If you have screen problems with an additional bar at the bottom, you can detect it with 如果屏幕有问题,底部有一个附加栏,则可以使用

$("body").height() != window.screen.height/window.devicePixelRatio

From here I am trying to trigger something that will remove the additional bar. 在这里,我试图触发一些将删除附加栏的操作。 Reload / redraw / etc ... 重新加载/重绘/等...

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM