1

This is my style

 <style name="NoActionbar" parent="android:style/Theme.NoTitleBar">

    <item name="android:statusBarColor">#1c465d</item>

</style

>

I want to change the splash screen, by remove the actionbar but i realise the default status bar colour is black, I am not able to change the colour of statusbar to green

why is this show?

How can I do it?

Ryan
  • 155
  • 1
  • 4
  • 18

4 Answers4

1

You can set the status bar color by defining the colorPrimaryDark item:

<item name="colorPrimaryDark">#1c465d</item>
manabreak
  • 4,719
  • 5
  • 32
  • 77
1

As stated above, set the colorPrimaryDark attribute in your style to whatever you like.

<resources>
  <!-- inherit from the material theme -->
  <style name="AppTheme" parent="android:Theme.Material">
    <!-- Main theme colors -->
    <!--   your app branding color for the app bar -->
    <item name="android:colorPrimary">@color/primary</item>
    <!--   darker variant for the status bar and contextual app bars -->
    <item name="android:colorPrimaryDark">@color/primary_dark</item>
    <!--   theme UI controls like checkboxes and text fields -->
    <item name="android:colorAccent">@color/accent</item>
  </style>
</resources>

http://developer.android.com/training/material/theme.html

To do it correctly you should declare your color value in the color.xml, then reference it from the style.

0

go to ~values/color.xml and replace colorPrimaryDark

<item name="colorPrimaryDark">#1c465d</item>
Ghanshyam Nayma
  • 1,437
  • 15
  • 23
0

This way you can set status bar color programatically

if (Build.VERSION.SDK_INT >= 21) {
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);         getWindow().setStatusBarColor(getResources().getColor(R.color.primary_dark));
}
Krishna Meena
  • 3,945
  • 4
  • 26
  • 42