androidandroid-studioandroid-scrollable-tabs

How to set the size of text in PagerTitleStrip


I am trying to make scrollable tabs and want to set the size of the title .How can I do this as I cant set the text size in PagerTitleStrip in the xml.Can some one tell me how to do this.


Solution

  • Add below style in your styles.xml

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

    And then

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