如何为我的整个PhoneGap应用程序修改屏幕方向为纵向 [英] How to fix screen orientation to portrait for my whole PhoneGap app
问题描述
如何将Phonegap应用程序配置为仅限于纵向模式,我有可能使用CSS或JavaScript进行操作,以便我能够在平台上获得一致的行为
How to configure the Phonegap app to be fixed to only portrait mode, I there any possibility to do it with CSS or JavaScript so that I should be able to get the consistent behaviour across the platforms
我发现这个有用的帖子 detect-displays-orientation-change-on-mobile-devices-with-accelerometer-a-platform-indipendent-方法
I found this useful post detecting-displays-orientation-change-on-mobile-devices-with-accelerometer-a-platform-indipendent-approach
这里解释了如何检测方向,但我需要对其进行配置
Here it is explained how to detect the orientation, but I need to configure it
是否可以通过CSS3媒体查询?
Is it possible through CSS3 Media queries?
推荐答案
要在纵向模式下修复您的方向,只需在活动代码中添加以下行在AndroidManifest.xml文件中:
To fix your orientation in portrait mode just add the below line in your activity tag in AndroidManifest.xml file:
android:screenOrientation="portrait"
或t他的活动类:
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
这篇关于如何为我的整个PhoneGap应用程序修改屏幕方向为纵向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!