簡體   English   中英

飛濺后Ionic 3長白屏

[英]Ionic 3 long white screen after splash

有沒有辦法在我啟動我的應用程序后立即獲得它,然后我獲得登錄屏幕,並使用 SplashScreen。

或者一種修改某些東西的方法,使我的動畫成為我的 SplashScreen ?

謝謝。

在 config.xml 中設置更長的超時時間,並在加載主屏幕時自行禁用它。

配置文件

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

app.component.ts

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

Ionic 默認隱藏啟動畫面,因此如果隱藏啟動畫面但主應用程序尚未准備好或主頁仍加載一些數據,您會發現白屏!。

建議的解決方案(控制隱藏啟動畫面):

  1. 默認情況下從配置首選項中禁用隱藏啟動屏幕。
  2. 手動隱藏它splashScreen.hide(); 當你想隱藏它時
    當平台准備好或在主頁控制器內時。

配置文件

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

app.component.ts 或 home.page.ts

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

您可以在生產模式下運行/構建您的應用程序。

對於 Android Build,例如: ionic cordova build android --prod

對於 Android Run,例如: ionic cordova run android --prod

使用離子cordova cli構建

使用 ionic cordova cli 運行

我現在測試的最佳解決方案是:

配置文件:

//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);

        });
    }

config.xml

 <preference name="auto-hide-splash-screen" value="false" /> 
 <preference name="AutoHideSplashScreen" value="false" />

main.js請更改

this.platform.ready().then(function () {
        _this.statusBar.styleDefault();
        _this.splashScreen.hide();
    });

this.platform.ready().then(function () {
            _this.statusBar.styleDefault();
            setTimeout(function(){
                _this.splashScreen.hide();

            }, 3000);
        });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM