如何将手机屏幕应用程序的方向锁定为肖像?
我当前的config.xml
正在使用此偏好设置:
<preference name="orientation" value="portrait"/>
然而,它没有任何区别,我仍然可以通过旋转我的移动测试设备来定位我的应用程序。
如果你知道一个活跃的phonegap / cordova社区,你可以发一个链接吗?
答案 0 :(得分:9)
如果您正在使用Android,则可以添加
android:screenOrientation="portrait"
到platforms / android / AndroidManifest.xml文件中的主要活动标签。
所以
<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
您可以使用reversePortrait或sensorPortrait