//系统自带方式设置
textView1.setTextColor(Color.RED);
//利用RGB设置
textView2.setTextColor(Color.rgb(255,255,0));
//16进制颜色代码设置
textView3.setTextColor(Color.parseColor("#CCCCCC"));
textView4.setTextColor(getResources().getColor(R.color.colorPrimary));
textView5.setTextColor(0xFF0000FF);
附效果图:
作者:Serein_my