4

In one of my activities, I don't want the status bar to have any color. I want it to stay in whichever color the is before my app is ran.

I can change it to black, but black isn't the default, the default is kind of transparent. I don't want tot try to find which transparency is the correct one because It might be different on other people's phones so I want to basically not use the color feature of the status bar in this particular activiy

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = getWindow();
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.setStatusBarColor(Color.BLACK);
 }
124697
  • 22,097
  • 68
  • 188
  • 315
  • Isn't default is black on Lollipop. If you don't set `colorPrimaryDark` in your theme you will get default color automatically. – Sharjeel Nov 29 '15 at 01:10

1 Answers1

6

By default title bar is colored using colorPrimaryDark (docs here, see pic below). Or when you look at Material theme:

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

You should also see this posts

enter image description here

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141