17

I am trying change status bar color for API level lower than 21.By changing the color primary in Theme style we can change the color in status bar for the API level 21.

Playstore

I am looking for how to change the status bar color for lower version

Can any one please help me ?

Anoop M Maddasseri
  • 10,213
  • 3
  • 52
  • 73
Binil Surendran
  • 2,524
  • 6
  • 35
  • 58

4 Answers4

15

Changing the color of statusbar is available from Lollipop

but actually you could change the color of statusbar for Api >= 19

inside the style of value-v19 put

<?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>

the background color of the status bar will became transparent color, and for coloring it you just put a background color in your to your app so the status bar will take that color

hope that was clear and helpful

Netero
  • 3,761
  • 2
  • 29
  • 29
4

Changing status bar color feature is only available from Lollipop onwards. Lower OS versions doesn't have this feature. There is no way for you to change the status bar color in pre lollipop devices.

Jayakrishnan Salim
  • 977
  • 1
  • 10
  • 24
3

Status bar coloring is not supported till date in latest version of AppCompat v7:23.1.0 too.

Take a look at Android developers blog post

From the post :

On older platforms, AppCompat emulates the color theming where possible. At the moment this is limited to coloring the action bar and some widgets.

Which means the AppCompat lib will only color status bars on Lollipop and above.

Anoop M Maddasseri
  • 10,213
  • 3
  • 52
  • 73
0

<< This is not the best solution (but might be the only one), but it works >>

Below API lvl v21, you can change the status bar color by changing your colorPrimaryDark (sometimes colorPrimary) attribute in the styles.xml file and inside the theme that you are using.

Now this may or many not be feasible for you and it may seem like a hack or just even be obvious to you. But I'm just posting it here because it worked for me and I really hadn't used the colorPrimary or colorPrimaryDark so I had no problems with it.

Max
  • 183
  • 2
  • 8