Search code examples
androidandroid-studioandroid-themebottom-navigation-bar

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


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