I want to understand how to express colors on Android. (Expressing it in six digits)

Asked 2 years ago, Updated 2 years ago, 73 views

I'm studying how to express colors on Android. I gave the background color to the linear layout as shown below. If you test it, there's a bit of transparency in gray.

<gradient android:startColor="#b4555555" android:endColor="#b4555555"
 android:angle="270.0" />

If I erase the last two digits (55), the transparent ones disappear. I don't quite understand why. It's like a beginner's question. Please let me know.

android hex color transparency

2022-09-21 14:55

1 Answers

When you give the color value, if you give 6 digits, it becomes RGB value. (Double digits represent red, green, blue.)) And if you give it to 8 digits, it becomes ARGB value (two digits represent transparency, red, green, and blue)

So if you first erase the last two digits from A=B4, R=55, G=55, B=55, then you get R=B4, G=55, B=55.


2022-09-21 14:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.