Transparent Backgrounds on Android Views

Transparent Backgrounds on Android Views

A frequent question encountered when using WebView inside of an Android app is “how do I make the background transparent, rather than the default white color?

This is ridiculously easy:

WebView myWebView = new WebView(this);

Happy Coding.

2 thoughts on “Transparent Backgrounds on Android Views

  1. Yeah, this works until you use JavaScript to show/hide a div, or do something else dynamic. The WebView doesn’t clear it’s canvas before drawing to it again, so you get terrible artifacts.


    1. I’m facing exactly the problem you described 😦
      Did you find any workarounds for WebView with transparent background not redrawing correctly after JavaScript manipulations?



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s