ActionBar的顏色有多種,包括自身的背景色,標題title的顏色,以及item項的文字顏色,控件的顏色都可以在xml中設置屬性,主要是自身的背景色和titile的背景色的設置
1.自身背景色的設置:
使用以下代碼:
mActionBar.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.bg_action_bar_normal));
2.title背景色的設置:
使用一下代碼:
int titleId = Resources.getSystem().getIdentifier("action_bar_title", "id", "android");
TextView title = (TextView) findViewById(titleId);
title.setTextColor(this.getResources().getColor(R.color.red));