1

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

1 Answers1

1

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

JustSightseeing
  • 1,460
  • 3
  • 17
  • 37
  • 1
    That's exactly what i was looking for but where to paste this code? – Zeeshan Ali Aug 09 '22 at 23:33
  • Well, it depends, if your app uses only an activity and no fragements at all: open activity_main.xml file that can be found in the resources, and there you will be able to modify bottomNavigationView – JustSightseeing Aug 09 '22 at 23:38
  • Sorry to disturb you again, but after searching, i have found that i asked the wrong question. I am actually talking about the SYSTEM navigation bar (Back, Home, and ~one-more-button). Also, i am still confused that where to paste your code. I have 5 activities, layouts, theme files, color files, toolbar layout... In which file i have to paste your code? I want to mark your answer as Correct... – Zeeshan Ali Aug 10 '22 at 00:03
  • This new code is not working when i pasted it in the `styles.xml` but i have found that your new provided code is already present in my `themes.xml` file. The mobile phone in which i am testing my app has `Android-8 (Oreo, API level 27)` maybe that's why this method is not working. I am using: - minSdkVersion: 19 - targetSdkVersion: 30 – Zeeshan Ali Aug 10 '22 at 01:35
  • I'm sorry but I do not know a solution that works for all devices for that low API levels, unfortunately android doesn't make it a very easy task for the lower APIs – JustSightseeing Aug 10 '22 at 10:05
  • 1
    Your provided code is OK, the problem was somewhere in my app. THANKS!! – Zeeshan Ali Sep 16 '22 at 19:21