How to change the background color of android status bar

This is possible on Kitkat and after.

If you want to use it in an application (like you asked), you could use this library https://github.com/jgilfelt/SystemBarTint

You only need to write:

// set a custom tint color for all system bars
tintManager.setTintColor(Color.parseColor("#99000FF"));   
// set a custom navigation bar resource
tintManager.setNavigationBarTintResource(R.drawable.my_tint);
// set a custom status bar drawable
tintManager.setStatusBarTintDrawable(MyDrawable);

Sorry, unless you are making a custom ROM this isn't possible, unless you only want the status bar changed for your app.

This would require a heck of a lot of work.

First you will need to add Theme.NoTitleBar.Fullscreen to your manifest

<application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        >

Then once you have done that you need to create a standard layout which represents the status bar, this would mean that you have to add the time, and also receive all the notifications from other apps, I do not personally know how to do that but I'm sure there is a way.

If you really want to do this goodluck, you have a hard time ahead of you.


Sorry, unless you have the knowledge how to build custom ROMS I do not think this is possible


In styles.xml do this:

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light">
        <item name="colorPrimary">@color/color_primary</item>
        <item name="colorPrimaryDark">@color/color_secondary</item>
        <item name="colorAccent">@color/color_accent</item>
         <!---Below is the code for status bar color------>
        <item name="android:statusBarColor">@color/color_primary</item>
    </style>
</resources>

Place this is in your values-v21/styles.xml, to enable this on Lollipop and later.

In order to do it programmatically you can do this:

Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(activity.getResources().getColor(R.color.example_color));