如何将我的 phonegap 应用程序的方向锁定为纵向?
我当前的 config.xml
正在使用此首选项:
<preference name="orientation" value="portrait"/>
但这没有什么区别,我仍然可以通过旋转我的移动测试设备来在两个方向上定位我的应用程序。
此外,如果您知道一个活跃的 phonegap/cordova 社区,您能否发布一个链接?
最佳答案
如果您使用的是 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
关于javascript - 纵向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20884724/