Android 控件设置随机颜色(三行代码,贼简单)

Random myRandom = new Random();

int ranColor = 0xff000000 | myRandom.nextInt(0x00ffffff);

tv.setBackgroundColor(ranColor);

你可能感兴趣的:(Android 控件设置随机颜色(三行代码,贼简单))