I'm trying to change the background color of a TabLayout
, but so far everything I've tried doesn't work.
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="#FF0000"
app:tabSelectedTextColor="#FF0000"
app:tabTextAppearance="@style/TabTextAppearance"
app:tabTextColor="#FFFFFF">
<com.google.android.material.tabs.TabItem
android:id="@+id/tab_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tab 1" />
<com.google.android.material.tabs.TabItem
android:id="@+id/tab_two"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tab 2" />
I've tried using a drawable (selector
) as advised here: https://stackoverflow.com/a/33230289/12221284
I've tried using a custom style extending the TabLayout style.
I've tried setting the XML attributes in my layout file directly.
Maybe I did something wrong, but nothing has worked so far and I don't understand why.