int color = Color.成YELLOW;
如何把color转化为#20540形式?
android开发中int型的颜色值转化为string
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- m13426650894 2019-09-19 17:07关注
private String getHexString(int color) {
String s = "#";
int colorStr = (color & 0xff000000) | (color & 0x00ff0000) | (color & 0x0000ff00) | (color & 0x000000ff);
s = s + Integer.toHexString(colorStr);
return s;
}解决 3无用