【发布时间】:2020-07-01 07:35:59
【问题描述】:
android默认使用Theme.AppCompat.Light.DarkActionBar主题,状态栏文字为白色,如何改成黑色?
【问题讨论】:
android默认使用Theme.AppCompat.Light.DarkActionBar主题,状态栏文字为白色,如何改成黑色?
【问题讨论】:
其实你可以改变 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>
【讨论】:
感谢@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>
【讨论】: