Android的转换颜色INT到六串 [英] Android convert color int to hexa String
本文介绍了Android的转换颜色INT到六串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public static int RGB(float[] hsv) {
return Color.HSVToColor(hsv);
}
这个函数添加一个int,弗罗马颜色。我怎样才能将其转换INT为六弦:#efefef
this function add an int, froma color. how can i convert that int to a hexa string: #efefef
推荐答案
st0le的答案是不正确的相对于颜色。它不工作,如果第一色成分是0,所以toHexString是没有用的。
The answer of st0le is not correct with respect to colors. It does not work if first color components are 0. So toHexString is useless.
然而,这code将正常工作:
However this code will work as expected:
String strColor = String.format("#%06X", 0xFFFFFF & intColor);
这篇关于Android的转换颜色INT到六串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文