在我的seTabColor()我設置標題文本的顏色爲灰色。我想在按下時將其更改爲白色。我該怎麼做?如何按下時改變標籤的文字顏色(currentTab)?
public void setTabColor(TabHost tabHost) {
for(int i = 0; i<tabHost.getTabWidget().getChildCount(); i++) {
// tabHost.getTabWidget().getChildAt(i).setBackgroundResource(r[i]);
tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.BLACK);
TextView t = (TextView) getTabWidget().getChildAt(i).findViewById(android.R.id.title);
t.setTextSize(9 * getResources().getDisplayMetrics().density);
// tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 58;
// tabHost.getTabWidget().getChildAt(i).().height = 58;
TextView tv = (TextView) tabHost.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
tv.setTextColor(Color.GRAY);
}
我想要做的是這樣的:tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab())...
但林不知道如何使用條件的改變文字顏色。
這是爲了改變標籤右邊的背景顏色,我只想改變標籤中的textview顏色。我的選項卡包含圖像和textview.I只想改變標籤中的textview顏色 – Prabha1 2015-03-30 05:22:28