Tab ItemIndicator not visible - Android TabLayout

15 Views Asked by At

I'm trying to display a white tab indicator that's 1 dp in height and extends the full width of the tab. However, nothing is being displayed except the text

layout.xml

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tab_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/plain_my_recipes"
            android:layout_marginTop="8dp"
            app:tabIndicatorHeight="1dp"
            app:tabIndicatorAnimationMode="fade"
            app:tabIndicator="@drawable/tab_indicator"
            app:tabIndicatorGravity="bottom"
            app:tabIndicatorColor="@android:color/white"
            app:tabSelectedTextAppearance="@style/tab_selected_text"
            app:tabSelectedTextColor="@android:color/white"
            app:tabTextAppearance="@style/tab_text"
            app:tabTextColor="@color/light_white">

tab_indicator.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="5dp" />
            <solid android:color="@android:color/white" />
        </shape>
    </item>
</layer-list>

I've tried removing everything in the tablayout and retaining the basics. I've also tried setting the tab indicator as @android:color/white and changing the tab indicator height to 5dp

The current result:

The tab layout display

0

There are 0 best solutions below