如何配置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
我发现这个有用的帖子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"
或此在活动类:
or this in the activity class:
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);