How to change on tap ripple-effect color of system/bottom navigation-bar buttons in Android Studio

Issue

I want to change the on-touched background ripple effect color of the navigation bar in android studio.
Like when someone presses or taps the navigation bar buttons, ripple effects show. But in my case, it’s not visible because my navigation bar color is white and the ripple effects color (on-tap) is also white so I want to change this ripple effect color to black so that it will be visible in the white navigation bar.

The device in which i am testing my app has Android-8 (Oreo, API-Level 27)

My project Details:

  • minSdkVersion: 19
  • targetSdkVersion: 30

Solution

You can use app:itemRippleColor attribute to change the color of the ripple effect.

 <com.google.android.material.bottomnavigation.BottomNavigationView
      app:itemRippleColor="@color/black"
  />

Edit:
Since you meant the system bottom bar, not the bottom navigation bar:

inside of the "styles.xml" you should paste this:

(Required API >= 28)

<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@android:color/white</item>

the "windowsLightNavigationBar" notifies the system that the App uses a light navigation bar, which changes the color of the ripple to gray I believe (which is the android standard)

If you app supports API versions < 28, check this question to find more similar solutions

Answered By – JustSightseeing

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published