I am using an image as the background of a linear layout in my android program.I need to set opacity for this.Can anyone tell me how can I do this?..The image that is translucent doesnt show the opacity,doesn’t know the reason though.
Thanks in advance for your valuable comments
I am using an image as the background of a linear layout in my
Share
If you set the background of the LinearLayout programatically this shouldn’t be any problem.
What you are looking for is the
Drawable.setAlpha(int alpha)method. From a personal project:Not exacly the same, but maybe you get the point.
You are using a drawable as the background of your layout. The challenge here is to get the variable representing your drawable. This is done here:
In the activity to the layout:
And it should work. At least it did work for me.