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 ?

4 Answers 4

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

1
  • 3
    This is good, how can I changed it's color instead of translucent? Commented Jun 23, 2016 at 11:31
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.

2
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.

1
  • You'd think. Sigh. Sometimes design choices made by Google is puzzling. Like what do they smoke over there? Commented Sep 29, 2019 at 1:21
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.