I have an background image set to an ImageView
, Now i want to change the opacity of an image without, for that i write this code to change the opacity of ImageView, but when i do so it remove the background image from the image view, So my question is how can i change the opacity of ImageView without removing background image form it.
Code i used is:
ImageView imageView = (ImageView) findViewById(R.id.image_view);
imageView.setBackgroundResource(R.drawable.theme1_page_header); // Set background image
int opacity = 100; // from 0 to 255
imageView.setBackgroundColor(opacity * 0x1000000); // change opacity of image