飞溅屏幕显示离子的黑屏

时间:2016-05-20 07:20:43

标签: cordova ionic-framework cordova-plugins splash-screen splash

我使用vs2015作为编辑。
这是我的config.xml文件
我已经安装了cordova-splashscreen插件 在我的应用程序图标中已经显示但是启动画面不显示

<?xml version="1.0" encoding="utf-8"?>
<widget id="com.ionicframework.ionicblankapp" version="0.0.1"  xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ionic-blankapp</name>
<description>
An Ionic Framework and Cordova project.
</description>
<author email="you@example.com" href="http://example.com.com/">
Your Name Here
</author>
<content src="index.html" />
<access origin="*" />
 <preference name="webviewbounce" value="false" />
 <preference name="UIWebViewBounce" value="false" />
 <preference name="DisallowOverscroll" value="true" />
 <preference name="android-minSdkVersion" value="16" />
 <preference name="BackupWebStorage" value="none" />
 <feature name="StatusBar">
   <param name="ios-package" onload="true" value="CDVStatusBar" />
 </feature>
  <preference name="KeepRunning" value="True" />
 <preference name="ShowTitle" value="True" />
 <preference name="InAppBrowserStorageEnabled" value="True" />
 <preference name="SuppressesIncrementalRendering" value="True" />
 <preference name="windows-target-version" value="10.0" />

 <preference name="SplashScreen" value="foo" />
 <preference name="SplashScreenDelay" value="10000" />

 <icon src="resources/icon.png" />

 <plugin name="cordova-plugin-device" spec="~1.1.1" />
 <plugin name="cordova-plugin-console" spec="~1.0.2" />
 <plugin name="cordova-plugin-whitelist" spec="~1.2.1" />
 <plugin name="cordova-plugin-statusbar" spec="~2.1.0" />
 <plugin name="ionic-plugin-keyboard" spec="~1.0.8" />
 <plugin name="cordova-plugin-splashscreen" version="3.1.0" />
 </widget>

2 个答案:

答案 0 :(得分:1)

设置config.xml,如文档:

<platform name="android">
    <!-- you can use any density that exists in the Android project -->
    <splash src="res/screen/android/splash-land-hdpi.png" density="land-hdpi"/>
    <splash src="res/screen/android/splash-land-ldpi.png" density="land-ldpi"/>
    <splash src="res/screen/android/splash-land-mdpi.png" density="land-mdpi"/>
    <splash src="res/screen/android/splash-land-xhdpi.png" density="land-xhdpi"/>

    <splash src="res/screen/android/splash-port-hdpi.png" density="port-hdpi"/>
    <splash src="res/screen/android/splash-port-ldpi.png" density="port-ldpi"/>
    <splash src="res/screen/android/splash-port-mdpi.png" density="port-mdpi"/>
    <splash src="res/screen/android/splash-port-xhdpi.png" density="port-xhdpi"/>
</platform>

<platform name="ios">
    <!-- images are determined by width and height. The following are supported -->
    <splash src="res/screen/ios/Default~iphone.png" width="320" height="480"/>
    <splash src="res/screen/ios/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="res/screen/ios/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="res/screen/ios/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="res/screen/ios/Default-Landscape~ipad.png" width="1024" height="768"/>
    <splash src="res/screen/ios/Default-Landscape@2x~ipad.png" width="2048" height="1536"/>
    <splash src="res/screen/ios/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="res/screen/ios/Default-667h.png" width="750" height="1334"/>
    <splash src="res/screen/ios/Default-736h.png" width="1242" height="2208"/>
    <splash src="res/screen/ios/Default-Landscape-736h.png" width="2208" height="1242"/>
</platform>

<platform name="windows">
    <!-- images are determined by width and height. The following are supported -->
    <splash src="res/screen/windows/splashscreen.png" width="620" height="300"/>
    <splash src="res/screen/windows/splashscreenphone.png" width="1152" height="1920"/>
</platform>

<platform name="blackberry10">
    <!-- Add a rim:splash element for each resolution and locale you wish -->
    <!-- http://developer.blackberry.com/html5/documentation/rim_splash_element.html -->
    <rim:splash src="res/screen/blackberry/splashscreen.png"/>
</platform>

<preference name="SplashScreenDelay" value="10000" />

并确保所有启动文件都在正确的位置并且大小正确

答案 1 :(得分:0)

请注意config.xml中的这一行是否具有正确的值,其中screen必须是生成的启动画面的名称。

<preference name="SplashScreen" value="screen" />

如果您不确定生成的闪屏名称的名称,请查看内部,例如platforms/android/res/...

如果您致电ionic resources,平台相关值将自动插入config.xml。您只需在icon.png目录中插入splash.pngresources