Cordova忽略屏幕方向锁定

num*_*web 7 android screen-orientation cordova

我正在使用Cordova 3.3.0和我的Galaxy S3(运行最新的Cyanogenmod)来测试我正在使用的应用程序; 我需要应用程序屏幕保持"纵向"模式并即使用户旋转设备也会被锁定.无论我尝试过什么或我遵循的教程,应用程序都忽略了锁定屏幕的首选项.我究竟做错了什么?

这是我的config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.numediaweb.test" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>Test</name>
    <description>
        Test.</description>
    <author href="http://test.com" email="abdel@test.com">
        me
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="orientation" value="portrait" />
    <preference name="fullscreen" value="true" />
    <preference name="SplashScreen" value="splash" />
    <preference name="SplashScreenDelay" value="3000" />
</widget>
Run Code Online (Sandbox Code Playgroud)

nde*_*den 14

修正了Cordova 3.4.1.现在偏好方向有效!

<preference name="orientation" value="portrait" />
Run Code Online (Sandbox Code Playgroud)

  • 我在3.5.0我不认为它是固定的.https://issues.apache.org/jira/browse/CB-6182 (2认同)

num*_*web 12

在我发布问题之后,我刚刚找到了一个有趣的答案(在右边的相关小部件中); 这是Cordova中的一个错误并且要修复它,你要么将AndroidManifest.xml编辑成类似的东西;

<activity android:screenOrientation="portrait" android:configChanges=...
Run Code Online (Sandbox Code Playgroud)

或者使用插件.

FI更喜欢编辑清单,因为它很容易.