将RGB转化为int:
int color=Color.rgb(red, green, blue)
如果需要透明度
int color=Color.argb(a,red, green, blue)
将int 转化为 RGB
int red = (color & 0xff0000) >> 16;
int green = (color & 0x00ff00) >> 8;
int blue = (color & 0x0000ff);
获取图片中的颜色:
ColorDrawable drawable = (ColorDrawable)holder.itemView.getBackground();
int color = drawable.getColor();
int alpha = drawable.getAlpha();
int red = (color & 0xff0000) >> 16;
int green = (color & 0x00ff00) >> 8;
int blue = (color & 0x0000ff);