public static String changeColor(int id, Context context){
StringBuffer stringBuffer = new StringBuffer();
int color = context.getResources().getColor(id);
stringBuffer.append("#");
stringBuffer.append(Integer.toHexString(Color.alpha(color)));
stringBuffer.append(Integer.toHexString(Color.red(color)));
stringBuffer.append(Integer.toHexString(Color.green(color)));
stringBuffer.append(Integer.toHexString(Color.blue(color)));
return stringBuffer.toString();
}
Android 根据color id 获取颜色16进制值
最新推荐文章于 2023-03-02 11:14:25 发布