[英]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.