【问题标题】:Ionic 3 long white screen after splash飞溅后的Ionic 3长白屏
【发布时间】:2020-12-29 20:41:07
【问题描述】:

有没有办法在我启动我的应用程序后立即获取它,然后我得到登录屏幕,然后就可以使用 SplashScreen。

或者一种修改某些东西的方法,让我的动画成为我的 SplashScreen ?

谢谢。

【问题讨论】:

标签: ionic-framework ionic3


【解决方案1】:

在 config.xml 中设置更长的超时时间,并在加载主屏幕时自行禁用它。

config.xml

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

app.component.ts

platform.ready().then(() => {
    splashScreen.hide();
});

【讨论】:

    【解决方案2】:

    Ionic默认隐藏闪屏,所以如果闪屏被隐藏但主应用程序还没有准备好或者主页仍然加载一些数据,你会发现白屏!。

    建议的解决方案(控制隐藏启动画面):

    1. 默认情况下从配置首选项中禁用隐藏启动屏幕。
    2. 想要隐藏时手动隐藏splashScreen.hide();
      在平台准备就绪时或在主页控制器内。

    config.xml

     <preference name="AutoHideSplashScreen" value="false" />
    

    app.component.ts 或 home.page.ts

    platform.ready().then(() => {
        splashScreen.hide();
    });
    

    【讨论】:

      【解决方案3】:

      您可以在生产模式下运行/构建您的应用程序。

      对于 Android 构建,例如:ionic cordova build android --prod

      对于 Android 运行,例如:ionic cordova run android --prod

      Build using ionic cordova cli

      Run using ionic cordova cli

      【讨论】:

        【解决方案4】:

        我现在测试的最佳解决方案是:

        config.xml:

        //Put a long time for splash screen delay to avoid that the splash screen hides and the interface become white:
        <preference name="SplashScreenDelay" value="50000" />
        //just animation duration before being hided
        <preference name="FadeSplashScreenDuration" value="800" />
        

        app.component.ts

          constructor(
            public platform: Platform,
            public statusBar: StatusBar,
            public splashScreen: SplashScreen
            ){
                // ensure that the interface is loaded by adding 500ms or less before hiding the splash screen manually
                this.platform.ready().then(() => {
                  setTimeout(() => {
                    this.splashScreen.hide();
                  }, 500);
        
                });
            }
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-04-21
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2021-09-10
          相关资源
          最近更新 更多