0

I am Struggling to change the color of the status bar for each activity.

I have tried the create theme and style listed in posts on this site to no avail.

How can I make each activity have a status bar of different color?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Griffin Fisch
  • 107
  • 3
  • 15

1 Answers1

2

You can change it by setting the android:statusBarColor or android:colorPrimaryDark attribute of the style you're using for your app in styles.xml.

(android:statusBarColor inherits the value of android:colorPrimaryDark by default)

For example (since we're using an AppCompat theme here, the android namespace is omitted):

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimaryDark">@color/your_custom_color</item>
</style>

On API level 21+ you can also use the Window.setStatusBarColor() method from code.

Abed Murad
  • 322
  • 1
  • 12