-2
如何更改font
的选定和未选中选项卡使用TabLayout
android?如何更改选定和未选择标签的字体intablayout?
如何更改font
的选定和未选中选项卡使用TabLayout
android?如何更改选定和未选择标签的字体intablayout?
使用这种方法来改变tablayout的文本字体
private void changeTabsFont() {
ViewGroup vg = (ViewGroup) tabLayout.getChildAt(0);
int tabsCount = vg.getChildCount();
for (int j = 0; j < tabsCount; j++) {
ViewGroup vgTab = (ViewGroup) vg.getChildAt(j);
int tabChildsCount = vgTab.getChildCount();
for (int i = 0; i < tabChildsCount; i++) {
View tabViewChild = vgTab.getChildAt(i);
if (tabViewChild instanceof TextView) {
((TextView) tabViewChild).setTypeface(Font.getInstance().getTypeFace(), Typeface.NORMAL);
}
}
}
}