int count = tabWidget.getChildCount();//TabHost中有一个getTabWidget()的方法
for (int i = 0; i < count; i++) {
View view = tabWidget.getChildTabViewAt(i);
view.getLayoutParams().height = 80; //tabWidget.getChildAt(i)
final TextView tv = (TextView) view.findViewById(android.R.id.title);
tv.setTextSize(28);
tv.setTextColor(this.getResources().getColorStateList(
android.R.color.white));
}
//解释二************************************************************************
int width =45;
int height =48;
for(int i = 0; i < tabWidget.getChildCount(); i++)
{
//设置高度、宽度,不过宽度由于设置为fill_parent,在此对它没效果
tabWidget.getChildAt(i).getLayoutParams().height = height;
tabWidget.getChildAt(i).getLayoutParams().width = width;
/**
* 下面是设置Tab的背景,可以是颜色,背景图片等
*/
View v = tabWidget.getChildAt(i);
if (tabHost.getCurrentTab() == i) {
v.setBackgroundColor(Color.GREEN);
//在这里最好自己设置一个图片作为背景更好
//v.setBackgroundDrawable(getResources().getDrawable(R.drawable.chat));
} else {
v.setBackgroundColor(Color.GRAY);
}
}