user3184899 user3184899 - 1 month ago 9x
Android Question

Change Material Design AppCompat ActionBar Color

I used to change AppCompat status bar color with

, and creating a style with a background which is the color I want.

Now, with Material Design AppCompat, this method doesn't work anymore.

Can you help me? Thanks.


There's a new attribute called colorPrimary which you can define in your Theme. This will give you ActionBar or Toolbar a solid color.

Following a little example:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">@color/my_action_bar_color</item>

Please note: It has to be only colorPrimary, not android:colorPrimary, in every values-folder except the values-v21 one.

You can read more about customizing the Color Palette on