问题描述
我有时在示例中看到 Android 中的着色是作为 #FF191919 完成的.我的意思是一个 8 位的十六进制数字.但它应该只是一个 6 位数字.它们有什么关系?如果我想将 6 位数字转换为 8 位数字.怎么做?我的意思是将 #424242 转换为 8 位数字着色?请让我知道详情.感谢您的时间和帮助.
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.
推荐答案
额外的 2 位数字用于定义颜色透明度或 alpha 通道.
The extra 2 digits are used to define the colors transparency, or alpha channel.
Android 使用 ARGB 格式(或您在示例中使用的 AARRGGBB)
Android uses the ARGB format (or AARRGGBB as you use in your example)
有关更多(Android 特定的)信息,请查看 Color 文档
For more (Android-specific) information take a look at the Color documentation
这篇关于Android 中的十六进制颜色有时是 8 位数字.如何?#FFFFFF 和 #FFFFFF00 有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!