I sometimes have seen in examples where the coloring in Android is done as #FF191919. I mean a 8 digit hex number . But it should be only a 6 digit number. How are they related? If I want o convert a 6 digit number to a 8 digit number. How to do it? I mean convert #424242 to a 8 digit number coloring? Please let me know the details. Thank you for your time and help.
问题:
回答1:
The extra 2 digits are used to define the colors transparency, or alpha channel.
Android uses the ARGB format (or AARRGGBB as you use in your example)
For more (Android-specific) information take a look at the Color documentation
回答2:
The first two characters are representing the alpha (transparency) value, where FF
is fully visible. This is known as aRGB.
回答3:
8-digit hex is an ARGB color. It is the same as usual RGB, but provides an extra alpha channel.
#RRGGBB
in RGB is the same as #00RRGGBB
in ARGB. Also take a look at Color.argb.
回答4:
the 8 digit color define with alpa level
let extract all we define hex color as 6 value pair of rgb 2 digit per
1st 2 digit for red, 2nd 2 digit for green and 3rd 2 digit for blue now if you want to set the alpha level of that then it define with the 8 digit as ARGB so, now 1st 2 digit value was define for the alpha and rest are for the RGB
回答5:
AN 8 digit Android HEx is called an aRGB. aRGB values are typically expressed using 8 hexadecimal digits, with each pair of the hexadecimal digits representing the values of the Alpha, Red, Green and Blue channel, respectively. For example 80FFFF00 represents 50.2% opaque (non-premultiplied) yellow. The 80 hex value, which is 128 in decimal, represents a 50.2% alpha value because 128 is approximately 50.2% of the maximum value of 255 (FF hex); to continue to decipher the 80FFFF00 value, the first FF represents the maximum value red can have; the second FF is like the previous but for green; the final 00 represents the minimum value blue can have (effectively – no blue). Consequently red + green yields yellow. In cases where the alpha is not used this can be shortened to 6 digits RRGGBB, this is why it was chosen to put the alpha in the top bits. Depending on the context a 0x or a number sign (#)[1] is put before the hex digits.