Cordova:屏幕不旋转
Cordova: screen not rotating
我对 Cordova 有疑问。当我编译我的测试应用程序并在我的设备上测试它时,WP8 中的屏幕不旋转;我怀疑它不会在 Android 或 iOS 中旋转。我明确地添加了首选项 Orientation "default"。
另外,如果我忽略该偏好,它也不起作用。我可以肯定地说,如果我将偏好方向 "default" 排除在外,它不会在 Android 或 iOS 上旋转。
我不确定是什么原因。有太多版本的 cordova 具有不兼容的首选项定义,我想我会在这里问。
我的 Cordova 版本:
cordova -version
5.0.0
我安装的插件:
cordova plugins list
cordova-plugin-whitelist 1.2.0 "Whitelist"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
org.apache.cordova.network-information 0.2.15 "Network Information"
我的config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="de.test.alexander.myapp" version="1.0.0.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
<name>My App</name>
<description>
My phonegap test app
</description>
<author email="alexander@gmail" href="http://localhost/">
Alexander
</author>
<content src="index.html" />
<preference name="Orientation" value="default" />
<preference name="permissions" value="internet" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="7" />
<preference name="android-installLocation" value="auto" />
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<icon src="icon.png" />
<!-- iPhone 6 / 6+ -->
<icon src="icon-60@3x.png" gap:platform="ios" width="180" height="180" />
<!-- iPhone / iPod Touch -->
<icon src="icon-60.png" gap:platform="ios" width="60" height="60" />
<icon src="icon-60@2x.png" gap:platform="ios" width="120" height="120" />
<!-- iPad -->
<icon src="icon-76.png" gap:platform="ios" width="76" height="76" />
<icon src="icon-76@2x.png" gap:platform="ios" width="152" height="152" />
<!-- Settings Icon -->
<icon src="icon-small.png" gap:platform="ios" width="29" height="29" />
<icon src="icon-small@2x.png" gap:platform="ios" width="58" height="58" />
<!-- Spotlight Icon -->
<icon src="icon-40.png" gap:platform="ios" width="40" height="40" />
<icon src="icon-40@2x.png" gap:platform="ios" width="80" height="80" />
<!-- iPhone / iPod Touch -->
<icon src="icon.png" gap:platform="ios" width="57" height="57" />
<icon src="icon@2x.png" gap:platform="ios" width="114" height="114" />
<!-- iPad -->
<icon src="icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="icon-72@2x.png" gap:platform="ios" width="144" height="144" />
<!-- iPhone Spotlight and Settings Icon -->
<icon src="icon-small.png" gap:platform="ios" width="29" height="29" />
<icon src="icon-small@2x.png" gap:platform="ios" width="58" height="58" />
<!-- iPad Spotlight and Settings Icon -->
<icon src="icon-50.png" gap:platform="ios" width="50" height="50" />
<icon src="icon-50@2x.png" gap:platform="ios" width="100" height="100" />
<icon src="ldpi.png" gap:platform="android" gap:qualifier="ldpi" />
<icon src="mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
<icon src="hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
<icon src="xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
<icon src="xxhdpi.png" gap:platform="android" gap:qualifier="xxhdpi" />
<gap:splash src="splash.png" />
<!-- iPhone and iPod touch -->
<gap:splash src="Default.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="Default@2x.png" gap:platform="ios" width="640" height="960" />
<!-- iPhone 5 / iPod Touch (5th Generation) -->
<gap:splash src="Default-568h@2x.png" gap:platform="ios" width="640" height="1136" />
<!-- iPhone 6 -->
<gap:splash src="Default-667h@2x.png" gap:platform="ios" width="750" height="1334" />
<gap:splash src="Default-Portrait-736h@3x.png" gap:platform="ios" width="1242" height="2208" />
<gap:splash src="Default-Landscape-736h@3x.png" gap:platform="ios" width="2208" height="1242" />
<!-- iPad -->
<gap:splash src="Default-Portrait.png" gap:platform="ios" width="768" height="1024" />
<gap:splash src="Default-Landscape.png" gap:platform="ios" width="1024" height="768" />
<!-- Retina iPad -->
<gap:splash src="Default-Portrait@2x.png" gap:platform="ios" width="1536" height="2048" />
<gap:splash src="Default-Landscape@2x.png" gap:platform="ios" width="2048" height="1536" />
<gap:splash src="land-ldpi.png" gap:platform="android" gap:qualifier="land-ldpi" />
<gap:splash src="land-mdpi.png" gap:platform="android" gap:qualifier="land-mdpi" />
<gap:splash src="land-hdpi.png" gap:platform="android" gap:qualifier="land-hdpi" />
<gap:splash src="land-xhdpi.png" gap:platform="android" gap:qualifier="land-xhdpi" />
<gap:splash src="port-ldpi.png" gap:platform="android" gap:qualifier="port-ldpi" />
<gap:splash src="port-mdpi.png" gap:platform="android" gap:qualifier="port-mdpi" />
<gap:splash src="port-hdpi.png" gap:platform="android" gap:qualifier="port-hdpi" />
<gap:splash src="port-xhdpi.png" gap:platform="android" gap:qualifier="port-xhdpi" />
<platform name="wp8">
<icon src="ApplicationIcon.png" width="99" height="99" />
<!-- tile image -->
<icon src="Background.png" width="159" height="159" />
<splash src="SplashScreenImage.jpg" width="768" height="1280"/>
</platform>
</widget>
我刚刚在
上查看了最新的 config.xml 文档
https://cordova.apache.org/docs/en/5.4.0/config_ref/index.html
对于 Android 台设备,您需要:
<platform name="android">
<preference name="Orientation" value="sensorLandscape" />
</platform>
和 iOS:
<platform name="ios">
<preference name="Orientation" value="all" />
</platform>
和黑莓:
<preference name="Orientation" value="landscape" />
但是没有关于Windows的文档。
我对 Cordova 有疑问。当我编译我的测试应用程序并在我的设备上测试它时,WP8 中的屏幕不旋转;我怀疑它不会在 Android 或 iOS 中旋转。我明确地添加了首选项 Orientation "default"。
另外,如果我忽略该偏好,它也不起作用。我可以肯定地说,如果我将偏好方向 "default" 排除在外,它不会在 Android 或 iOS 上旋转。
我不确定是什么原因。有太多版本的 cordova 具有不兼容的首选项定义,我想我会在这里问。
我的 Cordova 版本:
cordova -version
5.0.0
我安装的插件:
cordova plugins list
cordova-plugin-whitelist 1.2.0 "Whitelist"
org.apache.cordova.console 0.2.13 "Console"
org.apache.cordova.device 0.3.0 "Device"
org.apache.cordova.inappbrowser 0.6.0 "InAppBrowser"
org.apache.cordova.network-information 0.2.15 "Network Information"
我的config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget id="de.test.alexander.myapp" version="1.0.0.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
<name>My App</name>
<description>
My phonegap test app
</description>
<author email="alexander@gmail" href="http://localhost/">
Alexander
</author>
<content src="index.html" />
<preference name="Orientation" value="default" />
<preference name="permissions" value="internet" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="true" />
<preference name="webviewbounce" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="stay-in-webview" value="false" />
<preference name="ios-statusbarstyle" value="black-opaque" />
<preference name="detect-data-types" value="true" />
<preference name="exit-on-suspend" value="false" />
<preference name="show-splash-screen-spinner" value="true" />
<preference name="auto-hide-splash-screen" value="true" />
<preference name="disable-cursor" value="false" />
<preference name="android-minSdkVersion" value="7" />
<preference name="android-installLocation" value="auto" />
<preference name="SplashScreen" value="screen"/>
<preference name="SplashScreenDelay" value="3000" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<icon src="icon.png" />
<!-- iPhone 6 / 6+ -->
<icon src="icon-60@3x.png" gap:platform="ios" width="180" height="180" />
<!-- iPhone / iPod Touch -->
<icon src="icon-60.png" gap:platform="ios" width="60" height="60" />
<icon src="icon-60@2x.png" gap:platform="ios" width="120" height="120" />
<!-- iPad -->
<icon src="icon-76.png" gap:platform="ios" width="76" height="76" />
<icon src="icon-76@2x.png" gap:platform="ios" width="152" height="152" />
<!-- Settings Icon -->
<icon src="icon-small.png" gap:platform="ios" width="29" height="29" />
<icon src="icon-small@2x.png" gap:platform="ios" width="58" height="58" />
<!-- Spotlight Icon -->
<icon src="icon-40.png" gap:platform="ios" width="40" height="40" />
<icon src="icon-40@2x.png" gap:platform="ios" width="80" height="80" />
<!-- iPhone / iPod Touch -->
<icon src="icon.png" gap:platform="ios" width="57" height="57" />
<icon src="icon@2x.png" gap:platform="ios" width="114" height="114" />
<!-- iPad -->
<icon src="icon-72.png" gap:platform="ios" width="72" height="72" />
<icon src="icon-72@2x.png" gap:platform="ios" width="144" height="144" />
<!-- iPhone Spotlight and Settings Icon -->
<icon src="icon-small.png" gap:platform="ios" width="29" height="29" />
<icon src="icon-small@2x.png" gap:platform="ios" width="58" height="58" />
<!-- iPad Spotlight and Settings Icon -->
<icon src="icon-50.png" gap:platform="ios" width="50" height="50" />
<icon src="icon-50@2x.png" gap:platform="ios" width="100" height="100" />
<icon src="ldpi.png" gap:platform="android" gap:qualifier="ldpi" />
<icon src="mdpi.png" gap:platform="android" gap:qualifier="mdpi" />
<icon src="hdpi.png" gap:platform="android" gap:qualifier="hdpi" />
<icon src="xhdpi.png" gap:platform="android" gap:qualifier="xhdpi" />
<icon src="xxhdpi.png" gap:platform="android" gap:qualifier="xxhdpi" />
<gap:splash src="splash.png" />
<!-- iPhone and iPod touch -->
<gap:splash src="Default.png" gap:platform="ios" width="320" height="480" />
<gap:splash src="Default@2x.png" gap:platform="ios" width="640" height="960" />
<!-- iPhone 5 / iPod Touch (5th Generation) -->
<gap:splash src="Default-568h@2x.png" gap:platform="ios" width="640" height="1136" />
<!-- iPhone 6 -->
<gap:splash src="Default-667h@2x.png" gap:platform="ios" width="750" height="1334" />
<gap:splash src="Default-Portrait-736h@3x.png" gap:platform="ios" width="1242" height="2208" />
<gap:splash src="Default-Landscape-736h@3x.png" gap:platform="ios" width="2208" height="1242" />
<!-- iPad -->
<gap:splash src="Default-Portrait.png" gap:platform="ios" width="768" height="1024" />
<gap:splash src="Default-Landscape.png" gap:platform="ios" width="1024" height="768" />
<!-- Retina iPad -->
<gap:splash src="Default-Portrait@2x.png" gap:platform="ios" width="1536" height="2048" />
<gap:splash src="Default-Landscape@2x.png" gap:platform="ios" width="2048" height="1536" />
<gap:splash src="land-ldpi.png" gap:platform="android" gap:qualifier="land-ldpi" />
<gap:splash src="land-mdpi.png" gap:platform="android" gap:qualifier="land-mdpi" />
<gap:splash src="land-hdpi.png" gap:platform="android" gap:qualifier="land-hdpi" />
<gap:splash src="land-xhdpi.png" gap:platform="android" gap:qualifier="land-xhdpi" />
<gap:splash src="port-ldpi.png" gap:platform="android" gap:qualifier="port-ldpi" />
<gap:splash src="port-mdpi.png" gap:platform="android" gap:qualifier="port-mdpi" />
<gap:splash src="port-hdpi.png" gap:platform="android" gap:qualifier="port-hdpi" />
<gap:splash src="port-xhdpi.png" gap:platform="android" gap:qualifier="port-xhdpi" />
<platform name="wp8">
<icon src="ApplicationIcon.png" width="99" height="99" />
<!-- tile image -->
<icon src="Background.png" width="159" height="159" />
<splash src="SplashScreenImage.jpg" width="768" height="1280"/>
</platform>
</widget>
我刚刚在
上查看了最新的 config.xml 文档https://cordova.apache.org/docs/en/5.4.0/config_ref/index.html
对于 Android 台设备,您需要:
<platform name="android">
<preference name="Orientation" value="sensorLandscape" />
</platform>
和 iOS:
<platform name="ios">
<preference name="Orientation" value="all" />
</platform>
和黑莓:
<preference name="Orientation" value="landscape" />
但是没有关于Windows的文档。