如何在离子2中禁用闪屏? [英] How to disable splash screen in ionic 2?

查看:99
本文介绍了如何在离子2中禁用闪屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在config.xml中为splash屏幕将值更改为none。所以Splash屏幕没有显示出来。但白屏正在出现。有没有避免那个白屏?

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?

这是我的config.xml文件:

this is my config.xml file:

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


推荐答案

如上所述,您的应用需要时间来加载资产和渲染,所以如果你只是删除了它,你将不幸总是有白色屏幕。

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.

我建议你在config.xml中保留启动画面但是你仅替换相应平台内的默认splashcreen资源。例如,它看起来如下所示,您的资源从项目的根文件夹引用:

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.

这篇关于如何在离子2中禁用闪屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆