Black screen for Android app

五迷三道 提交于 2019-12-07 10:26:30

问题


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", [])

    }


来源:https://stackoverflow.com/questions/12994717/black-screen-for-android-app

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