如何修复屏幕方向potrait我的整个PhoneGap的应用程序 [英] How to fix screen orientation to potrait 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
我发现这个有用的帖子<一href="http://www.daveon$c$c.com/2008/12/15/detecting-displays-orientation-change-on-mobile-devices-with-accelerometer-a-platform-indipendent-approach-n95-i900-iphone-with-javascript/">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);
这篇关于如何修复屏幕方向potrait我的整个PhoneGap的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!