Deca
Deca

Reputation: 153

StatusBarColor doesn't change

I have imported this library https://github.com/neokree/MaterialNavigationDrawer for my NavigationDrawer. I used a suggested theme:

<style name="AppTheme" parent="MaterialNavigationDrawerTheme.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">#8bc34a</item>
    <item name="colorPrimaryDark">#558b2f</item>
    <item name="colorAccent">#FFFFFF</item>
    <item name="singleAccount">true</item>
</style>

When I create a new ActionBarActivity the statusBar is white and I can't understand why. The colorPrimaryDark is ignored. How can I make the status bar of the default color?

Upvotes: 2

Views: 424

Answers (1)

dsaket
dsaket

Reputation: 1896

Write this code in the oncreate function of your activity

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            getWindow().setStatusBarColor(Color.parseColor("#0288d1"));
}

Upvotes: 1

Related Questions