Black screen for Android app

2019-05-08 04:16发布

问题:

I have added a splash screen for an Android app. It displays, but it shows a black screen for two seconds after showing the splash screen.

How can I fix this?

回答1:

Based on your tags I assumed that you are facing issue for Android Phonegap app.

You have to close splash screen on device ready instead of giving specific time in loadUrl method.

Code Snippet:

super.setIntegerProperty("splashscreen", R.drawable.splash); // Display splash screen for android
this.setIntegerProperty("loadUrlTimeoutValue", 70000);
super.loadUrl("file:///android_asset/www/index.html",10000);// Give max time here

Hide splash screen in Phonegap onDeviceReady method :

document.addEventListener("deviceready", onDeviceReady, false);

    // Cordova is ready
    //
    function onDeviceReady() {
        cordova.exec(null, null, "SplashScreen", "hide", [])

    }