Action bar color is always black?

Viewed 536

I generated a project in Android Studio, and wish to support day and night theme. Android studio generates two themes.xml files, one for day and night theme respectively. However, I can't seem to get the action bar color to be anything except black when in night theme. It works perfectly in day theme by adjusting colorPrimary. Here is my themes.xml for my dark theme.

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.MyApp" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">@color/purple_500</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. -->
        <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
        <!-- Customize your theme here. -->
        <item name="colorAccent">@color/purple_200</item>
    </style>
</resources>
0 Answers
Related