如何在Jake Wharton的TitlePageIndicator中设置字体?

时间:2013-03-07 05:26:39

标签: android actionbarsherlock android-viewpager typeface

在我的应用程序中我使用Jake Wharton的TitlePageIndicator。我想知道我们是否可以将字体设置为TitlepagerIndicator。

这是xml,

<com.viewpagerindicator.TitlePageIndicator
     android:id="@+id/indicatortitle"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_marginBottom="10dp"
     android:padding="10dip"
     app:selectedColor="#000"
     android:textColor="#a0a0a0"
     android:textSize="25dp" />

并在主要活动中

    TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicatortitle);
indicator.setViewPager(mViewPager);
    indicator.setFooterIndicatorStyle(IndicatorStyle.Triangle);

1 个答案:

答案 0 :(得分:7)

如果查看代码TitlePageIndicator.java,您会看到它扩展了View并覆盖了setTypeface()方法,所以是。

只需执行:indicator.setTypeface(your_typeface);