How to disable splash screen in ionic 2?

我怕爱的太早我们不能终老 提交于 2019-12-24 01:53:15

问题


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:


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.



来源:https://stackoverflow.com/questions/42805109/how-to-disable-splash-screen-in-ionic-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!