【问题标题】:How to change status bar to light mode under min API 21如何在 min API 21 下将状态栏更改为浅色模式
【发布时间】:2020-07-01 07:35:59
【问题描述】:

android默认使用Theme.AppCompat.Light.DarkActionBar主题,状态栏文字为白色,如何改成黑色?

【问题讨论】:

    标签: android android-statusbar


    【解决方案1】:

    其实你可以改变 Api >= 19 的状态栏颜色

    value-v19 的样式里面放:

     <?xml version="1.0" encoding="utf-8"?>
    <resources>
            <style name="AppTheme" parent="MaterialDrawerTheme.Light">
                    <!-- Customize your theme here. -->
                    <item name="android:windowNoTitle">true</item>
                    <item name="android:windowTranslucentStatus">true</item>
                    .....
            </style>
    </resources>
    

    【讨论】:

      【解决方案2】:

      感谢@mohosyny 建议介绍材料主题,我使用以下AppTheme 解决了我的问题。

      <resources xmlns:tools="http://schemas.android.com/tools">
          <!-- Base application theme. -->
          <style name="AppTheme" parent="Theme.MaterialComponents.Light">
              <!-- Customize your theme here. -->
              <item name="colorPrimary">@color/colorPrimary</item>
              <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
              <item name="colorAccent">@color/colorAccent</item>
              <item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
          </style>
      </resources>
      

      【讨论】:

        猜你喜欢
        • 2015-05-28
        • 2017-01-23
        • 2020-02-08
        • 1970-01-01
        • 2017-08-16
        • 2020-08-18
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多