科尔多瓦忽略了屏幕方向锁



我正在使用Galaxy S3(运行最新的Cyanogenmod)使用Cordova 3.3.0来测试我正在使用的应用程序;我需要应用程序屏幕保持"肖像"模式,即使用户旋转设备也可以锁定。无论我尝试过什么或遵循的教程,该应用程序都忽略了锁定屏幕的偏好。我在做什么错?

这是我的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>

修复了Cordova 3.4.1 。现在偏好方向有效!

<preference name="orientation" value="portrait" />

我在发布问题后刚刚找到一个有趣的答案(在相关的小部件右边);这是科尔多瓦(Cordova)的错误并修复它,您要么将androidManifest.xml编辑为;

之类的东西
<activity android:screenOrientation="portrait" android:configChanges=...

或使用插件。

fi更喜欢编辑清单,因为它很容易。

解决方案是编辑这样的Android清单:

    <application
            android:icon="@drawable/icon"
            android:label="@string/app_name" >
            <activity
                android:name=".AppName"
                android:configChanges="orientation|keyboardHidden|screenSize"
                android:label="@string/app_name"
                android:launchMode="singleTask"
                android:screenOrientation="unspecified"
                android:theme="@android:style/Theme.Translucent.NoTitleBar" >

使用未指定的Android选择设备的适当方向。es。智能手机仅是肖像,但平板电脑是肖像和景观

最新更新