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

标签 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" />

在主要 Activity 中,

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

最佳答案

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

只需做:indicator.setTypeface(your_typeface);

关于android - 如何在 Jake Wharton 的 TitlePageIndicator 中设置字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15263750/

相关文章:

android - 按钮在我的 Activity 中不起作用

java - 从特定位置从 firebase 获取数据

android - 使用最新的支持版本在 MenuInflater Android 中获取空值

android - 具有 4 向滑动手势的自定义 Android View

Android意外按钮点击ViewPager滑动

javascript - 图像不会在钛构建 android 应用程序中显示

android - 如何提高具有多个类的 AIR for Android 应用程序的加载速度/发布速度?

android - 在 actionbarsherlock 中自定义 actionbar

java - 重构名称后出现 NoClassDefFoundError

android - 如何使用实例将自定义对象数组列表从 Activity 传递到 fragment