//初始化 random=new Random(); 方式一: int color=random.nextInt(0xffffff+1)+0xff000000; textView.setTextColor(color); 方式二: int red=random.nextInt(256); int green=random.nextInt(256); int blue=random.nextInt(256); //Color.rgb意思是用三个分别代表r、g、b的int值合成一个颜色 int color=Color.rgb(red, green, blue); textView.setTextColor(color);