Lucifer
Lucifer

Reputation: 23

Action Bar Color not changing no matter what?

I have tried every thing on stackoverflow to change my action bar color please help

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="Widget.AppCompat.Light.ActionBar">
    <item name="android:background">#b20e0f</item>
</style>

Upvotes: 1

Views: 45

Answers (2)

Glen Pierce
Glen Pierce

Reputation: 4841

You can do it programmatically:

To Hide the status bar: View decorView = getWindow().getDecorView(); int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions);

To hide the action bar: ActionBar actionBar = getSupportActionBar(); actionBar.hide();

More info here: http://developer.android.com/guide/topics/ui/actionbar.html https://developer.android.com/training/system-ui/status.html

Upvotes: 0

Athena
Athena

Reputation: 476

Change your style to:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="Widget.AppCompat.Light.ActionBar">
    <item name="background">@color/action_bar_bg</item>
</style>

Define "action_bar_bg" in res/values/colors.xml:

<color name="action_bar_bg">#b20e0f</color>

Reason: actionBarStyle is appcompat attribute. Don't use android: with it. Same for background.

Upvotes: 1

Related Questions