Phonegap 2.0 - On App Launch A White Screen Flashes Prior To My App Loading
Solution 1:
The problem is the WebView needs to be instantiated first and it defaults to a blank white page and then loadUrl is called which loads your application code. One way to get around it is to show a splashscreen until your app is loaded in the background.
Solution 2:
Based on the theme of your app, you can change the color of this flash background, eg: Light or Dark. This will minimise the effect.
Solution 3:
I also ran into the same issue. I get around this by setting the activity layout background between init and loadUrl. That way, I got the entire process cover: before splash screen shown, splash screen shown, splash screen hide, and then hide my splash screen after device ready.
super.onCreate(savedInstanceState);
super.init();
// set the layout background
root.setBackgroundDrawable(null);
root.setBackgroundResource(R.drawable.splash);
root.setBackgroundColor(Color.parseColor("#ffffffff"));
super.loadUrl(Config.getStartUrl(), 80000);
To reduce code, I set my splash screen in config.xml:
<preferencename="backgroundColor"value="0xffffffff" /><preferencename="splashscreen"value="splash" /><preferencename="AutoHideSplashScreen"value="false" /><preferencename="auto-hide-splash-screen"value="false" />
This is based on Cordova 2.8+. Splash screen on 2.7 is kinda wack.
In addition, if you experience issue with white screen on iOS. See iOS quirk section at bottom here: http://docs.phonegap.com/en/2.8.0/cordova_splashscreen_splashscreen.md.html#Splashscreen
Post a Comment for "Phonegap 2.0 - On App Launch A White Screen Flashes Prior To My App Loading"