Cannot change text size of com.google.android.material.tabs.TabItem in com.google.android.material.tabs.TabLayout

Viewed 598

What am I missing to make the TabItem text bigger? I've gone through all similar questions and tried many different statements. I've tried applying a style to the TabLayout as well as the TabItem and nothing seems to work, the text size doesn't change. Is this capability missing from the material design version? Thanks

activity_main.xml

<com.google.android.material.tabs.TabLayout
    style="@style/TabTheme"
    android:layout_width="694dp"
    android:layout_height="72dp"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:tabIndicatorHeight="6dp"
    app:tabTextAppearance="@style/TabTheme">

    <com.google.android.material.tabs.TabItem
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Clock In" />

styles.xml

<style name="TabTheme">
    <item name="android:textSize">40dp</item>
    <item name="android:textStyle">normal</item>
    <item name="android:textAllCaps">true</item>
    <item name="android:textColor">@color/primaryDarkColor</item>
    <item name="android:includeFontPadding">false</item>
</style>

I have also tried applying the following style to both TabLayout and TabItem with no result:

<style name="CustomTabText" parent="TextAppearance.Design.Tab">
    <item name="android:textSize">100sp</item>
</style>
1 Answers

It's working now. I've been creating a lot of test projects and this one still had the original theme definition by accident:

 <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

I changed it to a material theme:

  <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> 

That was the problem

Related