本文介绍了科尔多瓦3.1 Oriention不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有只应显示在纵向的应用程序(科尔多瓦3.1)。

I have an application (Cordova 3.1) which should only be displayed in portrait.

我的config.xml文件:

My config.xml:

<?xml version='1.0' encoding='utf-8'?>
<widget id="de.something.test" version="0.0.6" xmlns="http://www.w3.org/ns/widgets"
    xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Something 2.0</name>
<description>
    A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="[email protected]" href="http://cordova.io">
    Apache Cordova Team
</author>
<content src="index.html"/>
<access origin="*"/>
<preference name="fullscreen" value="false"/>
<preference name="webviewbounce" value="true"/>
<preference name="splashscreen" value="splash"/>
<preference name="splashScreenDelay" value="2000"/>
<preference name="DisallowOverscroll" value="true"/>
<preference name="target-device" value="handset"/>
<preference name="detect-data-types" value="false"/>
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="Orientation" value="portrait" />
</widget>

生成AndroidManifest.xml中运行'cordova打造android'后的文件夹中:

The generated AndroidManifest.xml after running ´cordova build android´ in the folder:

<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.6" android:windowSoftInputMode="adjustPan" package="de.pfeffermind.spyday" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<application android:debuggable="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/app_name" android:name="Something20" 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:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode" android:hardwareAccelerated="false" android:name="com.flurry.android.FlurryFullscreenTakeoverActivity" />
</application>
<uses-sdk android:minSdkVersion="10" android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

所以没有

&LT;活动机器人:名字=。SomeActivity
              机器人:标签=@字符串/ APP_NAME
              机器人:screenOrientation =肖像&GT;

禁用风景模式。

谁能帮助吗?

谢谢!

塞巴斯蒂安

推荐答案

通过config.xml的科尔多瓦锁定方位由于平台不一致我猜破:的。我安装了插件,要解决它,那么你的主模块中锁定的方向。

Cordova locking orientation via config.xml is broken due to platform inconsistency I guess: https://issues.apache.org/jira/browse/CB-5634. I Installed the plugin to workaround it, then in your main module lock the orientation.

    document.addEventListener('deviceready', function(){
        window.plugins.orientationLock.lock("landscape");
    });

这篇关于科尔多瓦3.1 Oriention不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:23