2

I'm developing an Android app and i found some issues in setting background color as transparent. I have one activity that contains one WebView. I load a page in this activity that contains a picture.

I want to visualize the png picture (with transparent background) in my app with no backgrounds.

So I did the following:

in my jsp:

...

<div style="background-color: transparent">
   <img src="linuxPicture.png">
</div>

in my Android class:

WebView webView = (WebView) convertView.findViewById(R.id.mWebView);
webView.setBackgroundColor(Color.TRANSPARENT);
webView.load("http://www.myWebPage.com");

But I think something wrong because i continue see the white background of the WebView. You can see this image (I think the problem is linked to html but I have no idea how resolve it)

Do you? Thanks

Samuel Adorni
  • 208
  • 2
  • 14

2 Answers2

4

Replace webView.setBackgroundColor(Color.TRANSPARENT);

with WebView.setBackgroundColor(Color.argb(1, 255, 255, 255));

See: Transparent WebView not working on Android v4.0

Bruke
  • 71
  • 6
1

I think it's wrong syntax. Try this

<div style="background-color: transparent"> <img src="linuxPicture.png"> </div>
tom
  • 9,550
  • 6
  • 30
  • 49