I have a button, onclick of that button a webview load a html from asset, it takes a while to load that html page, so in between a while color appears, in short words while switching to webview white color comes in background, i researched a lot but not got any thing.
How to fix ??? Kindly help.
Try to set the background color to the WebView:
webview.setBackgroundColor(0x01000000);
EDIT: if you want a black color:
webview.setBackgroundColor(0xFF000000);
If this doesn't work for you, I suggest you this workaround:
WebView inside a container (like a FrameLayout) and the set the background of
the container to blackWebView INVISIBLE when you need to load a new pageWebViewClient to the your WebView using setWebViewClient(). Your custom WebViewClient will set the WebView visible again when the page is loaded. During the load process, you will see a black background. webView.setWebViewClient(new InternalWebViewClient()); //... private class InternalWebViewClient extends WebViewClient { @Override public void onPageFinished(WebView view, String url) { super.onPageFinished( view, url ); webView.setVisibility(View.VISIBLE); } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With