JayVDiyk
JayVDiyk

Reputation: 4487

Disable Material Ripple on Tablayout

I am trying to remove the Material Ripple Effect on my TabLayout's Tabs.

I am wondering if it is possible to do this?

Any ideas please?

I have tried setting the stateListAnimator to null but it still does not work

    <android.support.design.widget.TabLayout
        android:id="@+id/tabLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stateListAnimator="@null"/>

Upvotes: 39

Views: 17157

Answers (6)

Gast&#243;n Saill&#233;n
Gast&#243;n Saill&#233;n

Reputation: 13129

Just add @null to the tabRippleColor attribute

 <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:tabRippleColor="@null" />  -> here

Upvotes: 8

Sumit Jain
Sumit Jain

Reputation: 1150

Add app:tabRippleColor

<com.google.android.material.tabs.TabLayout
     android:id="@+id/tabs"
     android:layout_width="match_parent"
     android:layout_height="48dp"
     app:tabRippleColor="@android:color/transparent"
     app:tabIndicatorColor="@android:color/transparent" />

Upvotes: 3

Latief Anwar
Latief Anwar

Reputation: 1868

Clean code

tabLayout.setTabRippleColorResource(android.R.color.transparent);

Upvotes: 2

kostyabakay
kostyabakay

Reputation: 1689

Add this line to TabLayout in XML: app:tabRippleColor="@null"

Upvotes: 33

SpongeCake
SpongeCake

Reputation: 610

app:tabBackground does not work in my case.

This is my solution:

tabLayout.setTabRippleColor(null);

Upvotes: 49

Daniel Juarez
Daniel Juarez

Reputation: 319

Try to change the background, for example, use the transparent color of android.

 <android.support.design.widget.TabLayout
    android:layout_width="match_parent"
    android:layout_below="@id/toolbar"
    android:layout_height="70dip"
    app:tabBackground = "@android:color/transparent"
    app:tabMode="fixed" />

Upvotes: 17

Related Questions