0

I created TabLayout with 3 items(the item in the middle is not an icon but a text).

How can I change the size of the text and his font?

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    app:tabTextColor="#777777"
    app:tabIndicatorColor="@color/hellrot"
    app:tabSelectedTextColor="@color/hellrot"
    app:tabIconTint="@color/your_color_selector"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
>

<android.support.design.widget.TabItem
    android:id="@+id/tabItem"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:icon="@drawable/ic_wc_black_24dp" />

<android.support.design.widget.TabItem
    android:id="@+id/tabItem2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Main"
/>

<android.support.design.widget.TabItem
    android:id="@+id/tabItem3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:icon="@drawable/ic_tag_faces_black_24dp" 
/>

</android.support.design.widget.TabLayout>

1 Answer 1

0

Write these below codes in styles.xml

Example:

<style name="MyTabItem" parent="TextAppearance.AppCompat.Button">
    <item name="android:textSize">18sp</item>
</style>

And in your TabItem, set the style like below.

<android.support.design.widget. TabItem
 style="@style/MyTabItem"
 android:layout_width="width"
 android:layout_height="height"/>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.