我有个问题。在白天主题中,我有一个浅色状态栏背景和深色文本,但是如果我将主题更改为夜间,状态栏背景会变暗,文本会变暗,但我需要文本变亮。我怎样才能做到这一点?
截图如下:
v23\主题代码:
<style name="Theme.Light" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/action_bar</item> // this color looks like background
<item name="colorOnPrimary">@color/white</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
</style>
night-v23\主题代码:
<style name="Theme.Night" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/action_bar</item> // this color looks like background
<item name="colorOnPrimary">@color/white</item>
<item name="colorPrimaryDark">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/white</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
</style>