如何更改android.support.design.widget.TabLayout的字体类型?
我正在使用样式解决此问题,但应用程序在API 16中崩溃。 谢谢。
答案 0 :(得分:0)
我发现了这种方式:
/etc/security/limits.conf
在本文中提及:Change the font of tab text in android design support TabLayout
答案 1 :(得分:0)
试试这段代码:
private void changeTabsFont(TabLayout tabLayout) {
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(/* your typeface */);
}
}
}
}