qingy2019
qingy2019

Reputation: 644

The Status Bar of Android Project can not change color

Here's my themes.xml

<resources xmlns:tools="http://schemas.android.com/tools">
    <!-- Base application theme. -->
    <style name="Theme.ColorMyViews" parent="Theme.AppCompat.DayNight.DarkActionBar">
        <!-- Primary brand color. -->
        <item name="colorPrimary">#BE19FF</item>
        <item name="colorPrimaryVariant">#a100e0</item>
        <item name="colorOnPrimary">@color/white</item>
        <!-- Secondary brand color. -->
        <item name="colorSecondary">@color/teal_200</item>
        <item name="colorSecondaryVariant">@color/teal_700</item>
        <item name="colorOnSecondary">@color/black</item>
        <!-- Customize your theme here. -->
    </style>
</resources>

The Status Bar color is not changing no matter what I try! Please help!

Upvotes: 1

Views: 2110

Answers (2)

qingy2019
qingy2019

Reputation: 644

Oh! I found out how to do it. You add this line to the bottom of the theme: <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>

That's because I'm using the latest Android Studio Version.

Upvotes: 2

javdromero
javdromero

Reputation: 1937

The status bar color is based on the colorPrimaryDark value of the current theme.

 <item name="colorPrimaryDark">????</item>

Upvotes: 1

Related Questions