android 動態設置顏色,使用系統顏色

TextView tvName = new TextView(this);
tvName.setText(ttyName);
tvName.setTextSize(28);
tvName.setBackgroundColor(Color.WHITE);

或者:

view.setBackgroundColor(Color.parseColor("#顏色值"));

XML文件中:

android:textColor="@android:color/white"

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章