How can I make an image transparent on Android?

The Solution to How can I make an image transparent on Android? is


Try this:

ImageView myImage = (ImageView) findViewById(R.id.myImage);
myImage.setAlpha(127); //value: [0-255]. Where 0 is fully transparent and 255 is fully opaque.

Note: setAlpha(int) is deprecated in favor of setAlpha(float) where 0 is fully transparent and 1 is fully opaque. Use it like: myImage.setAlpha(0.5f)

~ Answered on 2011-02-22 13:37:59


Most Viewed Questions: