Jeavie
Jeavie

Reputation: 212

Android: how to disable default pop TabLayout animation on tab selection

So, is there a way to disable animation when a tab is selected? I'd like to remove shadow/elevation. The idea is to keep it simple.

enter image description here

Here is my layout app bar code:

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/colorWhite"
    app:elevation="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent">

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorWhite"
        app:tabIndicatorColor="@android:color/transparent"
        app:tabIndicatorHeight="0dp">

        <android.support.design.widget.TabItem
            android:id="@+id/tabItem0"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout="@layout/tab_translator"
            android:icon="@drawable/ic_translator"/>

        <android.support.design.widget.TabItem
            android:id="@+id/tabItem1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout="@layout/tab_history"
            android:icon="@drawable/ic_history"/>

        <android.support.design.widget.TabItem
            android:id="@+id/tabItem2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout="@layout/tab_dialog"
            android:icon="@drawable/ic_dialog"/>

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

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

Any help will be appreciated.

Upvotes: 0

Views: 1750

Answers (1)

Brijesh Joshi
Brijesh Joshi

Reputation: 1857

Add app:tabBackground="@color/white" in your TabLayout that will work

Upvotes: 3

Related Questions