PagerSlidingTabStrip更改标题字体

时间:2015-02-04 20:50:23

标签: android android-fonts pagerslidingtabstrip

我想更改PagerSlidingTabStrip中标签的字体,这是我尝试的方式,但它没有效果。

MyPagerAdapter pagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
    viewPager.setAdapter(pagerAdapter);
    pagerSlidingTabStrip.setViewPager(viewPager);
    pagerSlidingTabStrip.setTextColor(getResources().getColor(R.color.white));
    pagerSlidingTabStrip.setTypeface(Typeface.createFromAsset(getAssets(), getString(R.string.ronney_sans_regular_font)), Typeface.NORMAL);
    pagerSlidingTabStrip.setIndicatorColor(getResources().getColor(R.color.second_primary_color));

1 个答案:

答案 0 :(得分:0)

如果您使用此库:

https://github.com/jpardogo/PagerSlidingTabStrip

在PagerSlidingTabStrip类更改行185:

mTabTextTypeface = Typeface.create(tabTextTypefaceName, mTabTextTypefaceStyle);

到此:

mTabTextTypeface = Typeface.create(Typeface.createFromAsset(context.getAssets(),"DroidNaskh.ttf"), mTabTextTypefaceStyle);