How to disable splash screen in ionic 2?

2019-07-13 14:27发布

I have changed the value to none for splash screen in the config.xml. So Splash screen is not showing up. But the white screen is showing up. Is there away to avoid that white screen?

this is my config.xml file:

<preference name="SplashScreenDelay" value="0"/> 
<preference name="ShowSplashScreen" value="false"/> 
<preference name="SplashScreen" value="none"/>

1条回答
孤傲高冷的网名
2楼-- · 2019-07-13 14:59

As said above, your app needs time to load the assets and render, so you will unfortunately always have that white screen if you just remove the splash.

I would suggest that in config.xml you keep the splashcreen but that you only replace the default splashcreen resource inside the respective platform. For instance, it would looks like below, with your resources referenced from the root folder of your project:

 <platform name="android">
    <splash src="resources/android/splash/drawable-port-ldpi-screen.png" density="port-ldpi"/>
    <splash src="resources/android/splash/drawable-port-mdpi-screen.png" density="port-mdpi"/>
    <splash src="resources/android/splash/drawable-port-hdpi-screen.png" density="port-hdpi"/>
    <splash src="resources/android/splash/drawable-port-xhdpi-screen.png" density="port-xhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxhdpi-screen.png" density="port-xxhdpi"/>
    <splash src="resources/android/splash/drawable-port-xxxhdpi-screen.png" density="port-xxxhdpi"/>
 </platform>
 <platform name="ios">
    <splash src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" height="1136"/>
    <splash src="resources/ios/splash/Default-667h.png" width="750" height="1334"/>
    <splash src="resources/ios/splash/Default-736h.png" width="1242" height="2208"/>
    <splash src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" height="2048"/>
    <splash src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" height="2732"/>
    <splash src="resources/ios/splash/Default-Portrait~ipad.png" width="768" height="1024"/>
    <splash src="resources/ios/splash/Default@2x~iphone.png" width="640" height="960"/>
    <splash src="resources/ios/splash/Default~iphone.png" width="320" height="480"/>
 </platform>

I have never worked with animated splashscreens however and don't know if it will work.

查看更多
登录 后发表回答