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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 100% — FF 95% — F2 90% — E6 85% — D9 80% — CC 75% — BF 70% — B3 65% — A6 60% — 99 55% — 8C 50% — 80 45% — 73 40% — 66 35% — 59 30% — 4D 25% — 40 20% — 33 15% — 26 10% — 1A 5% — 0D 0% — 00 |
Another Example:Â Use the below code for black:
1 2 3 | <color name="black">#000000</color> |
Now if you want to use opacity then you can use the below code:
1 2 3 | <color name="black">#99000000</color> |
Set transparent background of an imageview on Android
The article was published on February 3, 2018 @ 10:56 AM
Leave a Comment