Reputation: 586
Note: I don't want to fix this issue by specifying app:tabTextAppearance="@android:style/TextAppearance.Widget.TabWidget"
in the TabLayout xml, because that overrides the default tab style which I like.
I tried the other solution mentioned here: Android Tablayout Set textAllCaps to False not working, which involved included specifying both textAllCaps
and android:textAllCaps
to false
in my styles.xml
specification. However, my tab layout continues to show the ta texts as capitalized:
Below is my styles.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="standardTabLayout" parent="Widget.Design.TabLayout">
<item name="textAllCaps">false</item>
<item name="android:textAllCaps">false</item>
</style>
</resources>
Below is my activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
style="@style/standardTabLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Calendar" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Input" />
</com.google.android.material.tabs.TabLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Upvotes: 1
Views: 446
Reputation: 574
You can specify your style in Text Appearance like below :
app:tabTextAppearance="@style/standardTabLayout"
Tab layout code will look like below :
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
style="@style/standardTabLayout"
android:layout_width="0dp"
app:tabTextAppearance="@style/standardTabLayout"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
Upvotes: 1