-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);
}
}
}
}