//随机生成颜色
Random myRandom=new Random();
int ranColor = 0xff000000 | mRandom.nextInt(0x00ffffff);
// 随机颜色
Random random = new Random();
int []ranColor ={0xff000000,0x00ff00ff,0xff000000,0x00ffff00,0x00ffffff,0x00ff0000}; //0xff000000 | random.nextInt(0x00ffffff);
for(int i=0;i<ranColor.length;i++){
holder.iv_dynamic_pic.setBackgroundColor(ranColor[i]);
}
// 随机颜色
Random random = new Random();
//#FFFFF0
//int ranColor = 0xff000000 | random.nextInt(0x00ffffff);
int []ranColor ={0xffFFFFF0,0xffF5FFFA, 0xffFFE7B,
0xffF0F8FF, 0xffEECFA1, 0xffF5FFFA,0xffFFF0F5,0xffEEE9E9}; //0xff000000 | random.nextInt(0x00ffffff);
int randomcolor =random.nextInt(ranColor.length);
//int color = Color.argb(1, random.nextInt(255) / 255, random.nextInt(255) / 255, random.nextInt(255) / 255);
holder.iv_dynamic_pic.setBackgroundColor(ranColor[randomcolor]);
// 随机颜色
Random random = new Random();
int []ranColor ={0x00FFFFCC,0xCCFFFF,0xff000000,0x00ffff00,0x00FFFFCC,0x00ff0000}; //0xff000000 | random.nextInt(0x00ffffff);
int randomcolor =random.nextInt(ranColor.length);
int color = Color.argb(1, random.nextInt(255) / 255, random.nextInt(255) / 255, random.nextInt(255) / 255);
holder.iv_dynamic_pic.setBackgroundColor(color);
/**
* 获取十六进制的颜色代码.例如 "#6E36B4" , For HTML ,
* @return String
*/
public static String getRandColorCode(){
String r,g,b;
Random random = new Random();
r = Integer.toHexString(random.nextInt(256)).toUpperCase();
g = Integer.toHexString(random.nextInt(256)).toUpperCase();
b = Integer.toHexString(random.nextInt(256)).toUpperCase();
r = r.length()==1 ? "0" + r : r ;
g = g.length()==1 ? "0" + g : g ;
b = b.length()==1 ? "0" + b : b ;
return r+g+b;
}
// 随机颜色
Random random = new Random();
int ranColor = 0xff000000 | random.nextInt(0x00ffffff);
holder.iv_dynamic_pic.setBackgroundColor(ranColor);