Hello Everyone! In this post, I want to share how to set transparent background of control on Android?? Let’s start.


If you want to add 20% or 30% transparency, you should pre-pend two more characters to the hexadecimal code, like CC. Like: android:background="#CCFF0088" in XML, where CC is the alpha value, FF is the red factor, 00 is the green factor, and 88 is the blue factor. Some opacity code you can use in android:


Another Example:  Use the below code for black:

Now if you want to use opacity then you can use the below code:

Set transparent background of an imageview on Android

Leave a Comment