问题描述
我为手机应用程式新增了启动画面。
I have added splash screen for my phonegap app.
我正在线上建立phonegap应用程式 。
I am building phonegap app online at http://build.phonegap.com.
Splash
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns = "http://www.w3.org/ns/widgets"
xmlns:gap = "http://phonegap.com/ns/1.0"
xmlns:android = "http://schemas.android.com/apk/res/android"
id = "com.clerisy.arcade"
versionCode = "10"
version = "1.0.0" >
<!-- versionCode is optional and Android only -->
<name>xxxxxxxxxxxxx</name>
<description>
xxxxxxxxxxxxxxxxx
</description>
<author href="https://build.phonegap.com" email="[email protected]">
xxxxxxxxxxxxxxxx
</author>
<preference name="permissions" value="none"/>
<preference name="phonegap-version" value="3.6.3" />
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="false" />
<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="backgroundColor" value="0xff38c0f4"/>
<preference name="AutoHideSplashScreen" value="false" />
<preference name="ShowSplashScreenSpinner" value="false" />
<!-- Plugins -->
<!-- Core plugins -->
<gap:plugin name="org.apache.cordova.inappbrowser" version="0.5.2" />
<gap:plugin name="org.apache.cordova.network-information" version="0.2.12" />
<gap:plugin name="nl.x-services.plugins.socialsharing" version="4.3.8" />
<gap:plugin name="org.apache.cordova.device" version="0.2.12" />
<gap:plugin name="com.phonegap.plugin.statusbar" version="1.1.0" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<!-- Set Icon and splash screen -->
<icon src="icon.png" platform="android" width="57" height="57" density="mdpi" />
<gap:splash src="screen.png"/>
<gap:config-file platform="ios" parent="CFBundleShortVersionString">
<string>100</string>
</gap:config-file>
<content src="index.html" />
<access origin="*" />
</widget>
隐藏splashscreen我使用
to hide splashscreen i am using
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Hide splash Screen
setTimeout(function() {
navigator.splashscreen.hide();
}, 2000);
问题是: -
推荐答案
安装splash screen插件
Install the splash screen plugin
cordova plugin add org.apache.cordova.splashscreen
对于iOS,你必须在文档准备好的超时函数内隐藏启动屏幕,你可以定义启动屏幕应该隐藏的持续时间。
For iOS you have to hide splash screen inside timeout function in document ready, you can define the duration after which the splashscreen should hide.
setTimeout(function() {
navigator.splashscreen.hide();
}, 8000);
在config.xml中将autohide splash设置为false
set autohide splash to false in config.xml
<preference name="AutoHideSplashScreen" value="false" />
有关详细信息,请参阅插件文档
Refer the plugin documentation for more detail https://github.com/apache/cordova-plugin-splashscreen/blob/master/doc/index.md
这篇关于cordova [phonegap]设置启动屏幕不能正常工作在ios的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!