更改导航栏颜色,Android [英] Change navigation bar color, Android
问题描述
如何在 Lollipop 之前的设备中将导航栏的颜色/透明度从黑色更改为通用颜色(例如状态栏或操作栏的颜色)?
How can I change the color/transparency of the Navigation Bar from black to a generic color in pre-Lollipop devices (e.g. the color of the status bar or of the action bar)?
我可以使用 AppCompat 来实现还是仅适用于 SDK 21?
Can I do it using AppCompat or is it only possible for SDK 21?
推荐答案
您可以在 AppCompat 主题中设置属性 navigationBarColor
,或者在原生 v21 中设置 android:navigationBarColor
主题.
You can set the attribute navigationBarColor
in an AppCompat theme, or android:navigationBarColor
in a native v21 theme.
<style name="AppTheme" parent="@style/Theme.AppCompat.Light">
...
<item name="navigationBarColor">#123456</item>
</style>
https://developer.android.com/training/material/theme.html#StatusBar一个>
请注意,这不适用于 Pre-Lollipop 设备,因为此功能需要系统支持,而在 Android 4.4 或更早版本上则不支持.
Note that this does not work on Pre-Lollipop devices, since this feature needs to be supported by the system, which is not the case on Android 4.4 or older.
这篇关于更改导航栏颜色,Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!