Why is the real background color of the ActionBar different in the night theme than in the xml? During the day everything is fine.
P.s. Actually Day Presumably Day
Actually Night Presumably Night
P.s. values/style.xml:
<resources>
<style name="Theme.DarkActionBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:statusBarColor">@color/purple_700</item>
</style>
...
</resources>
values-night/style.xml:
<resources>
<style name="Theme.DarkActionBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<item name="android:statusBarColor">@color/purple_700</item>
</style>
...
</resources>
Change background color of actionbar.
values-night/style.xml:
<resources>
<style name="ActionBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="colorSurface">?attr/colorPrimary</item>
</style>
<style name="Theme.DarkActionBar" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<item name="actionBarTheme">@style/ActionBar</item>
<item name="colorPrimary">@color/purple_200</item>
...
</style>
...
</resources>