您的位置:首页 > 移动开发 > Android开发

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();

    }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: