The usual way to represent colors in ARGB (sometimes RGBA, but that's just a name) is in hex. No one uses a decimal number system to represent color digitally.
set yellow color on the button text: button.setTextColor(0xFFFFFF00); . Now we set the yellow button text.
ARGB consists of 4 channels. each with 8 bits. first channel - alfa - 0x FF FFFFFF; alfa - opacity level (in this case we have the maximum value). the second is red - 0xFF FF FF00, etc .; green and blue respectively.
The easiest way to create a color in an ARGB color model with a decimal number system is to use the Color class.
Color class has all the basic static functions and fields. In your case, you can use the static function Color.rgb(int red, int, green, int blue) , where red, green, blue should be in the range from 0 to 255. Alfa bits are set by default to max - 255 or in hex - 0xff.
Now that you know how to represent a color in a hexadecimal number system, it will be very easy to create color in an xml resource file.
source share