How to remove white background in web view?

I have the following problem: I upload an html file to webview. The background color of my html file and my activity are black. It happens that at the end of the download there is a short white flash, because the background color of the web view is white.

Can I delete this flash drive? Or set the web browser color to black? I already tried setting the background color in webview xml to black, but this did not work.

+4
source share
2 answers

Yes, you can. Try:

webview.setBackgroundResource(Color.Black); 
+5
source

I had the same issue and this resolved this for me:

Only below existing

 mWebView = (WebView) findViewById(R.id.activity_main_webview); 

I added a line

 mWebView.setBackgroundColor(Color.BLACK); 

To do something good, he must be up to

 mWebView.loadUrl(...) 
+1
source

Source: https://habr.com/ru/post/1435377/


All Articles