gpt4 book ai didi

Android statusBarColor 与 colorPrimaryDark

转载 作者:太空宇宙 更新时间:2023-11-03 12:28:35 25 4
gpt4 key购买 nike

These two fields have same affect but statusBarColor has higher precedence in theme

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@android:color/black</item>
<item name="android:colorAccent">@color/colorAccent</item>
</style>

在上面的代码中,状态栏是黑色,但在下面的代码中,状态栏是白色

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="android:colorPrimary">@color/colorPrimary</item>
<item name="android:colorPrimaryDark">@android:color/black</item>
<item name="android:statusBarColor">@android:color/white</item>
<item name="android:colorAccent">@color/colorAccent</item>
</style>

AppCompat Theme 的主要区别是什么?

最佳答案

来自 developer.android.com

To set a custom color for the status bar, use the android:statusBarColor attribute when you extend the material theme. By default, android:statusBarColor inherits the value of android:colorPrimaryDark.

关于Android statusBarColor 与 colorPrimaryDark,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41138733/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com