纵向? [英] Portrait Orientation?
问题描述
如何将我的phonegap应用程序的方向锁定为纵向?
How do I lock the orientation of my phonegap application to portrait?
我当前的config.xml
使用此首选项:
My current config.xml
is using this preference:
<preference name="orientation" value="portrait"/>
但是没有什么区别,我仍然可以通过旋转移动测试设备来双向定位应用程序.
However it makes no difference and I can still orientate my application in both orientations by rotating my mobile test device.
如果您知道一个活跃的phonegap/cordova社区,还可以发布链接吗?
Also if you know of a an active phonegap/cordova community could you please post a link?
推荐答案
如果您使用的是Android,则可以添加
If you are working with Android you can add
android:screenOrientation="portrait"
转到platforms/android/AndroidManifest.xml文件中的主要活动标签.
to the main activity tag in the platforms/android/AndroidManifest.xml file.
所以
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="inappbrowser" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
成为
<activity android:screenOrientation="portrait" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="inappbrowser" android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
如果需要其他肖像变化,请另外注意.来自: http://developer.android.com/guide/topics/manifest/activity-element. html
Just another note in case you want other portrait variations. From: http://developer.android.com/guide/topics/manifest/activity-element.html
您可以使用reversePortrait或sensorPortrait
You could use reversePortrait or sensorPortrait
这篇关于纵向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!