如何在Android中将颜色整数转换为十六进制字符串? - How to convert a color integer to a hex String in Android?

10/14 00:20
阅读数 0

问题:

I have an integer that was generated from an android.graphics.Color我有一个从android.graphics.Color生成的整数

The Integer has a value of -16776961整数的值为 -16776961

How do I convert this value into a hex string with the format #RRGGBB如何将此值转换为格式为 #RRGGBB 的十六进制字符串

Simply put: I would like to output #0000FF from -16776961简单地说:我想从 -16776961 输出 #0000FF

Note: I do not want the output to contain an alpha and i have also tried this example without any success注意:我不希望输出包含 alpha 并且我也尝试过这个例子但没有成功


解决方案:

参考一: https://en.stackoom.com/question/RRJv
参考二: https://stackoom.com/question/RRJv
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部