且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将RGB颜色转换为十六进制颜色

更新时间:2022-06-11 00:15:37

解决方案:

只需使用:

String hex = String.format("#%02x%02x%02x", redValue, greenValue, blueValue);

这会将所有红色,绿色和蓝色值转换为十六进制字符串.

This will convert all the Red, Green and Blue values to Hex String.

希望有帮助.