tabhost.getCurrentTabView().setBackgroundColor(Color.CYAN); //设置默认选中状态的背景
tabhost.setOnTabChangedListener(new OnTabChangeListener() { @Override
public void onTabChanged(String tabId) {
for(int i = 0; i < tabWidge.getChildCount(); i++) { View tabView = tabWidge.getChildAt(i); if(tabhost.getCurrentTab() == i) { tabView.setBackgroundColor(Color.CYAN); } else { tabView.setBackgroundColo(Color.BLACK)); //未选中的颜色
}
}
}
});
tabhost.setOnTabChangedListener(new OnTabChangeListener() { @Override
public void onTabChanged(String tabId) {
for(int i = 0; i < tabWidge.getChildCount(); i++) { View tabView = tabWidge.getChildAt(i); if(tabhost.getCurrentTab() == i) { tabView.setBackgroundColor(Color.CYAN); } else { tabView.setBackgroundColo(Color.BLACK)); //未选中的颜色
}
}
}
});
解决方案 »
- 如何让eclipse中的android代码可以高亮显示系统关键字等功能,方便代码阅读
- android开机震动代码
- 怎样取得android短信数据库中发件人收件人的名字?
- android模拟器太卡了
- ExpandableListView.setTextFilterEnabled(boolean enabled)
- android手机端怎么直接访问服务器
- 部署android环境问题
- ListView 点击一个item另外几个Item响应(估计好多人没遇到过)
- 求助:linux on android 安装ubuntu挂载loop device 的问题
- Android Studio出现“Cannot resolve symbol XXXX”问题应该如何解决?
- 音乐播放器重新打开时,背景音乐或者正在播放的歌曲自动停止
- listview 的item一个接着一个的飞入特效
mTabHost.setCurrentTab(0);
home_radio = (RadioButton) findViewById(R.id.home_radio);
home_radio.setChecked(true);
int[] hots=new int[]{R.drawable.red1,R.drawable.red1,R.drawable.red,R.drawable.red,R.drawable.red};
@Override
public void onTabChanged(String tabId) {
for (int i = 0; i < tabWidget.getChildCount(); i++) {
View vvv = tabWidget.getChildAt(i);
if (tabHost.getCurrentTab() == i) {
vvv.setBackgroundResource(hots[i]);
} else {
vvv.setBackgroundResource(R.drawable.match_bg_score);
}
}
}
});