How to set a TypeFace to PagerTabStrip text views

六眼飞鱼酱① 提交于 2019-12-01 07:35:50

A little late but here is one solution. Get the child views of the PagerTabStrip and check if it is an instance of a TextView. If it is, set the typeface:

for (int i = 0; i < pagerTabStrip.getChildCount(); ++i) {
    View nextChild = pagerTabStrip.getChildAt(i);
    if (nextChild instanceof TextView) {
       TextView textViewToConvert = (TextView) nextChild;
       textViewToConvert.setTypeface(PUT_TYPEFACE_HERE)
    }
}

Inspect the PagerTabStrip with Hierarchy View (in Eclipse open Hierarchy View perspective when you run the application) and search for its children. One must be a TextView that holds the tab's title. Get this TextView and set its typeface.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!