我为 Android 应用程序添加了启动画面。它显示,但在显示初始屏幕后显示黑屏两秒钟。
我该如何解决这个问题?
最佳答案
根据您的标签,我认为您遇到了 Android Phonegap 应用程序的问题。
您必须在设备准备就绪时关闭启动画面,而不是在 loadUrl 方法中给出具体时间。
代码 fragment :
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
在 Phonegap onDeviceReady 方法中隐藏启动画面:
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
cordova.exec(null, null, "SplashScreen", "hide", [])
}
关于android - Android 应用黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12994717/