How to manage the Blank White Loading screen of an Android Webview?

Robbe picture Robbe · Mar 14, 2011 · Viewed 23.4k times · Source

This is more of a visual thing than a direct issue, but when a WebView loads in my application, the screen is blank white for between 2-4 seconds until the content is fully loaded. The time is dependent on the size of content that is loading.

Is there a way to manage this, so that the screen will only refresh to the content when loaded? Something like a "loading..." animation or something similar? I just do not want the plain white screen presented to my users.

I have a splash screen that then loads the WebView. The WebView works fine after that initial blank pause (while loading), but I would like to hold it on a particular screen until the page has loaded or have a black screen with a progress loader.

Is there something that detects a load complete perhaps? If that were the case, I could use it as a trigger.

Does anyone know of a way to manage this blank white screen?

Thanks!

/r

Answer

Lawrence Cherone picture Lawrence Cherone · Oct 1, 2011

You could alternatively make the webview transparent:

webview.setBackgroundColor(0x00000000);