[英]Android string.xml color
Color specified as 颜色指定为
<font fgcolor="#ffff0000">red</font>
works, while 工作,而
<font fgcolor="#0000FF">blue</font>
does not work. 不起作用。
How fix this problem? 怎么解决这个问题?
On Android color is defined as ARGB
where A
stands for alpha channel
(transparency). 在Android上,颜色定义为ARGB
,其中A
代表alpha channel
(透明度)。 For alpha, value of 00
means fully transparent, and FF
means fully opaque. 对于alpha,值00
表示完全透明, FF
表示完全不透明。 So when you define your color as RGB
, ommiting A
part, then A
is being considered as set to 00
which in result makes your color fully transparent, thus your color is invisible
and may look like not working
. 因此,当您将颜色定义为RGB
,省略A
部分,则A
被视为设置为00
,结果使您的颜色完全透明,因此您的颜色invisible
,可能看起来not working
。 This behaviour sometimes can differ and lack of of A
can be interpreted as opaque, but this is rather exception so it's safer to always specify alpha value. 这种行为有时可能会有所不同,缺少A
可能会被解释为不透明,但这是异常,因此始终指定alpha值更安全。 BTW: color cannot work anyway :) BTW:颜色无论如何都无法工作 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.