Android状态栏StatusBar颜色修改
<!-- 文字及图标颜色:true为深色,false为浅色 -->
<item name="android:windowLightStatusBar">true</item>
<!-- 背景色 -->
<item name="android:statusBarColor">?android:attr/colorPrimary</item>
去除actionbar
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.Pine" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<!-- 文字及图标颜色:true为深色,false为浅色 -->
<item name="android:windowLightStatusBar">true</item>
<!-- 背景色 -->
<item name="android:statusBarColor">@color/white</item>
<!-- Customize your theme here. -->
</style>
</resources>
核心代码:
<style name="Theme.Pine" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- 文字及图标颜色:true为深色,false为浅色 --> <item name="android:windowLightStatusBar">true</item> <!-- 背景色 --> <item name="android:statusBarColor">@color/white</item>