是否可以删除TabHost / TabWidget中文本和Tab顶部之间的图标(指示符)和空格?我只是想要显示文字,但我不能。
提前致谢。
答案 0 :(得分:1)
将TextView传递给具有相关文本的setIndicator(View v)方法。如果你想要广泛的样式,我建议你将自己的“Tab”模型作为参数传递。
public class Tab extends LinearLayout {
public Tab(Context c, int drawable, String label) {
super(c);
TextView tv = new TextView(c);
tv.setText(label);
tv.setTextColor(getResources().getColorStateList(R.color.tab_text_color));
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
tv.setGravity(0x01);
setOrientation(LinearLayout.VERTICAL);
if (drawable != 0) {
ImageView iv = new ImageView(c);
iv.setImageResource(drawable);
addView(iv);
}
addView(tv);
}
}