I\'m using ViewPagerIndicator, and haven\'t had any luck, so I\'ll ask here. Is there a way to change the font for the Tabs in a TabPageIndicator?
You don't need to use an other third party lib in order to do this, you can modify the TabView class(in TabPageIndicator) like this(this assuming you want the same font in your entire app):
private class TabView extends TextView {
private int mIndex;
public TabView(Context context) {
super(context, null, R.attr.vpiTabPageIndicatorStyle);
}
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// Re-measure if we went beyond our maximum size.
if (mMaxTabWidth > 0 && getMeasuredWidth() > mMaxTabWidth) {
super.onMeasure(MeasureSpec.makeMeasureSpec(mMaxTabWidth, MeasureSpec.EXACTLY), heightMeasureSpec);
}
}
public int getIndex() {
return mIndex;
}
public TabView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public TabView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public TabView(Context context) {
super(context);
init();
}
private void init() {
Typeface tf = Typeface.createFromAsset(getContext().getAssets(), "fonts/myFont.ttf"); // setting a custom TypeFace
setTypeface(tf);
}