Set transparent background of an imageview on Android

mudit picture mudit · Sep 29, 2009 · Viewed 749.6k times · Source

I am using a web view in which I am adding an image view. How can I set the background of this image view to transparent?

I have tried this:

mImageview.setBackgroundResource(R.color.trans);

Where trans<color name="trans">#00000000 </color>.

Answer

Chirag Patel picture Chirag Patel · Mar 10, 2012

You can set the background transparent of any layout, any view, or any component by adding this code in XML:

android:background="@android:color/transparent"