Android: 如何在选项卡选择时禁用默认弹出 TabLayout 动画

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

那么,有没有办法在选择选项卡时禁用动画?我想删除 shadow/elevation。我们的想法是保持简单。

这是我的布局应用程序条码:

<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>

如有任何帮助,我们将不胜感激。

在您的 TabLayout 中添加 app:tabBackground="@color/white" 即可