I have the following problem: I am loading a html file into a webview. The background color of my html file and my activity is black. What happens is that there is a short white flash at the beginning when finished loading because the background color of the webview is white.
Can I remove that flash? Or set that webview color to black? I already tried setting the background color in the webview xml to black, but it didn't work.
I had the same problem and this solved it for me:
Just below the existing
mWebView = (WebView) findViewById(R.id.activity_main_webview);
I added the line
mWebView.setBackgroundColor(Color.BLACK);
To do any good it must be before
mWebView.loadUrl(...)
Yes you can. Try:
webview.setBackgroundResource(Color.Black);
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