How to disable gray animation from center to edges on bottom navigation on tap
Asked Answered
T

4

6

Having reviewed a lot of material, I still did not find a solution. As you can see on git below, when you tap on the botton navigation icon, it has gray animation from the center to the edges. Is there a way to disable this animation?

Gray animation Here's my XML

<com.google.android.material.bottomnavigation.BottomNavigationView
        android:id="@+id/bottom_navigation"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="bottom"
        android:background="@android:color/white"
        app:elevation="0dp"
        app:itemIconTint="@color/bottomNavigationIconColor"
        app:itemTextColor="@drawable/nav_item_text_color_state"
        app:labelVisibilityMode="labeled"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:menu="@menu/bottom_navigation_main" />

and nav_item_text_color_state

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:state_checked="false"
        android:color="@color/bottomNavigationIconColor" />
    <item
        android:state_checked="true"
        android:color="#005EFF" />
</selector>

Update Found solution to this. To disable this gray ripple effect just add app:itemBackground="@null" to xml.

Tributary answered 15/5, 2019 at 21:9 Comment(1)
provide your code or xml fileHypoglycemia
K
7

Use app:itemRippleColor="@color/your_color" to set your custom color for tap effect or app:itemRippleColor="@null" for no effect

Karmakarmadharaya answered 19/2, 2021 at 23:10 Comment(2)
this is wrong answerEstellaestelle
app:itemRippleColor="@null" worked for meAstrea
T
5

Found solution to this, just add app:itemBackground="@null" to xml.

Tributary answered 16/5, 2019 at 8:58 Comment(0)
A
5

Set app:itemBackground to null doesn't work now.

The new way is:

app:itemBackground="@android:color/transparent" 
Apperceive answered 14/7, 2022 at 7:38 Comment(0)
U
1

None of the codes above worked for me. If that's the case for you too, try this:

app:itemActiveIndicatorStyle="@null"
app:itemBackground="@android:color/transparent"
Undis answered 7/10, 2023 at 22:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.