Skip to content Skip to sidebar Skip to footer

Android: How To Change My Action Bar Background Color

I used Android Studio to create a project with activity that uses ListView and a navigation drawer template, I'm targeting API 14+ and I'm testing on Galaxy Note 3 Kitkat - the res

Solution 1:

The thing is you're extending ActionBarActivity which comes with AppCompat package and implementing Widget.Holo.Light.ActionBar style to it. It is obvious you'll be getting that error. So do one thing just update your style a little as follow:

<stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar"><!-- Customize your theme here. --><itemname="colorPrimaryDark">@color/primaryDarkColorActionBar</item><itemname="colorPrimary">@color/primaryColorActionBar</item></style>

Also, ActionBarActivity is deprecated in latest appcompat update i.e. 22.1.1 . So better use AppCompatActivityinstead.

Solution 2:

Actually just change:

<!-- ActionBar styles --><stylename="MyActionBar"parent="@android:style/Widget.Holo.Light.ActionBar"><itemname="android:background">@drawable/blue_action_bar_color</item></style>

to be:

<!-- ActionBar styles --><stylename="MyActionBar"parent="@style/Widget.AppCompat.Light.ActionBar"><itemname="android:background">@drawable/blue_action_bar_color</item></style>

Post a Comment for "Android: How To Change My Action Bar Background Color"