简体   繁体   English

如何在 Android Studio 中更改底部导航栏按钮的点击波纹效果颜色

[英]How to change on tap ripple-effect color of 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.我想在 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.但在我的情况下,它是不可见的,因为我的导航栏颜色是白色,并且波纹效果颜色(点击时)也是白色,所以我想将此波纹效果颜色更改为黑色,以便它在白色导航栏中可见.

You can use app:itemRippleColor attribute to change the color of the ripple effect.您可以使用app:itemRippleColor属性来更改波纹效果的颜色。

 <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:在“styles.xml”中你应该粘贴这个:

(Required API >= 28) (需要 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) “windowsLightNavigationBar”通知系统应用程序使用了轻导航栏,我相信它将波纹的颜色变为灰色(这是android标准)

If you app supports API versions < 28, check this question to find more similar solutions如果您的应用支持 API 版本 < 28,请查看问题以找到更多类似的解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何更改android studio底部导航栏上选择的图标颜色 - How to change the icon color selected on bottom navigation bar in android studio 如何更改底部导航栏点击动画的颜色? - How to change the color of bottom navigation bar tap animation? Kotlin android studio 底部导航栏选中项周围的颜色怎么改? - How to change the color that is around the selected item in android studio bottom navigation bar in Kotlin? Android studio - 更改 NOT OF BOTTOM NAVIGATION VIEW 的颜色 - Android studio - change color of NOT OF BOTTOM NAVIGATION VIEW Android Studio 底部导航栏颜色怎么改? - how to change the colour of bottom navigation bar in Android Studio? 选中时如何更改导航栏元素的颜色 ANDROID STUDIO - How to change color of navigation bar elements when they are selected ANDROID STUDIO 如何更改按钮波纹效果的颜色 - How to change the color of ripple effect of a Button 如何强制底部导航中的按钮位于android studio的底部 - How to force the buttons in bottom navigation to be at the bottom in android studio Android 在底部导航栏中禁用缩放效果 - Android Disable zoom effect in bottom navigation bar 如何改变Android中涟漪效应的持续时间? - How to change duration of ripple effect in Android?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM