Android 根据color id 获取颜色16进制值
2017-11-03 14:55
711 查看
public static String changeColor(int id){
StringBuffer stringBuffer = new StringBuffer();
int color = CommentManager.getInstance().getContext().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)));
4000
return stringBuffer.toString();
}
StringBuffer stringBuffer = new StringBuffer();
int color = CommentManager.getInstance().getContext().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)));
4000
return stringBuffer.toString();
}
相关文章推荐
- android 根据图片名字获取图片id
- Android中资源id的获取,根据id获取资源以及根据资源名称获取id。
- android 根据图片名字获取图片id
- Android开发中根据图片名称获取在drawable中的ID
- android 根据文件名获取图片资源id
- 精确获取屏幕尺寸 判断是否是平板 文字根据状态更改颜色 android:textColor 背景色根据状态更改颜色 android:backgroup 启动APK的默认Activit
- Android:根据图片的名称获取对应的资源id
- Android根据图片文件名获取它的资源ID 的两种方式
- 根据颜色值获取颜色常量名: ColorToIdent
- Android根据图片资源ID获取文件名
- Android根据图片文件名获取它的资源ID 的两种方式
- Android中实现根据资源名获取资源ID
- Android根据资源文件名获取它的资源ID 的两种方式
- Android项目,library中根据资源id获取资源
- android根据id获取string.xml等静态资源
- Android 根据drawable中图片的名称获取ID
- Android根据字符串型的资源名获取对应资源id
- Android 根据字符串获取资源id
- android 根据资源id 获取 资源名称
- android通过反射根据包名和id或name获取resource ID