title: Transparent PNG in WebView on Android
body: <p>I have some PNG files with transparent backgrounds that I want to put in a web page to view in an Android WebView. The WebView is set to have an image as a background. I've noticed the transparency works in, say, Google chrome, even on the cell phone itself, but the images come up with a white background in my WebView. Here is the markup for the page:</p>
  
  <pre><code>&lt;div id="image_container"&gt;
      &lt;img src="teststicker1.png" style="background-color:transparent;"  /&gt;
      &lt;img src="teststicker2.png" style="background-color:transparent;" /&gt;
      &lt;img src="teststicker3.png" style="background-color:transparent;"/&gt;
      &lt;img src="teststicker4.png" style="background-color:transparent;"/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I achieve transparency so the background falls through to the background of the WebView instead of being white? I've searched this site and found similar questions but none quite the same, and none of the answers there worked.</p>
  
  <p>The code for initializing the WebView is</p>
  
  <pre><code>myWebView.loadUrl(getActivity().getResources().getString(R.string.site_url)+getActivity().getResources().getString(R.string.image_picker_html));
  myWebView.setBackgroundResource(R.drawable.image_gallery_2_2);              
  myWebView.setBackgroundColor(Color.TRANSPARENT);
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/13fbF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/13fbF.png" alt="enter image description here"></a></p>