如何更改导航栏图标的颜色? (Android Studio) [英] How do I change the color of the navigation bar icons? (Android studio)

查看:2132
本文介绍了如何更改导航栏图标的颜色? (Android Studio)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为避免混淆navigationbar实际上是什么,这是一个

To avoid confusion as to what the navigationbaractually is, here's a

如您所见,我使用以下方法添加了新的颜色,而不是标准的黑色:

As you can see, I've added a new color instead of the standard black color using:

<item name="android:navigationBarColor">@color/colorBackground</item>

但是这些图标现在几乎看不见,因此我想将它们更改为黑色,或者至少变暗.我已经搜索过SO和Webb,但是空手而归.有任何想法吗?

But the icons are barely visible now, so I would like to change them into being black, or at least darker. I have searched SO and the webb but came up empty handed. Any ideas?

推荐答案

您不能自行更改按钮的颜色. 但是,您可以尝试将navigationbarlight设置为true.应该注意的是,这仅在API级别27中可用.

You cannot change the color of the buttons yourself. However you can try to set the navigationbarlight to true. It should be noted that this is only available from API level 27.

windowLightNavigationBar 已添加到API级别27

windowLightNavigationBar added in API level 27

int windowLightNavigationBar

如果设置,将绘制导航栏以使其兼容 带有浅色导航栏背景.

If set, the navigation bar will be drawn such that it is compatible with a light navigation bar background.

要使其生效,该窗口必须绘制系统栏 windowDrawsSystemBarBackgrounds和导航的背景 不得要求bar与 windowTranslucentNavigation.对应设置 装饰视图上的SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR.

For this to take effect, the window must be drawing the system bar backgrounds with windowDrawsSystemBarBackgrounds and the navigation bar must not have been requested to be translucent with windowTranslucentNavigation. Corresponds to setting SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR on the decor view.

可能是布尔值,例如"true"或"false".

May be a boolean value, such as "true" or "false".

这篇关于如何更改导航栏图标的颜色? (Android Studio)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆