【问题标题】:How to set the size of text in PagerTitleStrip如何在 PagerTitleStrip 中设置文本的大小
【发布时间】:2016-03-27 22:01:54
【问题描述】:

我正在尝试制作可滚动的选项卡并想设置标题的大小。我该怎么做,因为我无法在 xml 中的 PagerTitleStrip 中设置文本大小。有人可以告诉我该怎么做吗?

【问题讨论】:

    标签: android android-studio android-scrollable-tabs


    【解决方案1】:

    在你的styles.xml中添加下面的样式

    <style name="viewPagerTitleStrip">
        <item name="android:textColor">@color/primary_dark_material_light</item>
        <item name="android:textSize">20sp</item>
    </style>
    

    然后

    <android.support.v4.view.PagerTitleStrip
            android:id="@+id/pager_title_strip"
            style="@style/viewPagerTitleStrip"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_gravity="top"
            android:background="@color/white"
            android:paddingTop="4dp"
            android:paddingBottom="4dp" />
    

    【讨论】:

    • 使用渐变我可以设置标题的背景吗?
    【解决方案2】:

    下面是一个如何做的例子: 在你的 xml 中:

     <android.support.v4.view.PagerTitleStrip
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/MyCustomTabText"/>
    

    在styles.xml中

    <style name="MyCustomTabText">
        <item name="android:textSize">12sp</item>
    </style>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-05
      • 2014-03-08
      • 1970-01-01
      • 2012-05-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-21
      相关资源
      最近更新 更多