user2137817 user2137817 - 1 year ago 74
Android Question

How to make a linearLayout partially transparent in android?

I have a

containing 2
one of them is partially covering the other. I want to make the part of the
on top transparent so I can also see the 2nd
knowing that i have 2 images as background for the 2

Answer Source

When we set the color it is like ARGB(Alpha Red Green Blue). You need to change the alpha in the color code to increase or decrease the amount of Transparency :

You can range it from 00 to FF (Hexa Decimal)

For maximum transparency => #00555555 (Here 00 stands for the alpha)

For minimum or no transparency => #FF555555 (Here FF stands for the alpha)

So, for setting the transparency of an ImageView you can code like this:

ImageView image = (ImageView) findViewById(;

Also, you can set the alpha for your LinearLayout like this :

LinearLayout ll = (LinearLayout) findViewById(;