【问题标题】:White navigationbar with grey icons带有灰色图标的白色导航栏
【发布时间】:2018-03-13 11:21:23
【问题描述】:

如何在我的 Android 应用中获得这种风格?白色导航栏和灰色图标。一个例子是打开应用程序抽屉时。

我尝试了很多选择,但都没有成功。 应用程序 minSdkVersion 是 21,棒棒糖。

我已经看到了这个解决方案,但我没有设法应用它:

Status bar turns white and does not show content behind it

【问题讨论】:

    标签: android themes android-styles navigationbar


    【解决方案1】:

    对于 API >= 23

    试试:

    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR); 
    

    OR 风格:

    <item name="android:windowLightStatusBar">true</item>
    <item name="colorPrimary">@color/colorWhite</item>
    <item name="colorPrimaryDark">#colorPrimaryDak</item>
    <item name="colorAccent">@color/colorAccent</item>
    

    对于 API

    在 v21/style 下声明。

    <item name="colorPrimaryDark" tools:targetApi="23">@color/colorPrimary</item> // white
    <item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
    

    更新:

    <item name="colorPrimaryDark">@color/colorPrimary</item> // white
    <item name="android:windowLightStatusBar" tools:targetApi="23">true</item>
    

    【讨论】:

    • 谢谢,但是这个解决方案需要最少 sdk 23,对吧?
    • 21,我在上面提到过。它似乎不起作用,通知栏变成灰色,但不是白色:(
    • 好吧,tools:targetApi="23" 不需要写colorPrimaryDark,因为它也适用于低版本。 android:windowLightStatusBar 很好。
    • 我做了,但没有,你能解释一下为什么会起作用吗?
    • 我不明白谁在为这个答案投票。此解决方案可能不适用于版本 21-22 API
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-19
    • 2017-05-31
    • 2013-12-29
    • 2016-01-29
    • 1970-01-01
    相关资源
    最近更新 更多