Widget.AppCompat.Button colorButtonNormal shows gray

To customize one button only set android:theme="@style/AppTheme.Button" to your button.

<Button
    android:theme="@style/AppTheme.Button"
    />

Define your style as you did in your question

<style name="AppTheme.Button" parent="Base.Widget.AppCompat.Button">
    <item name="colorButtonNormal">@color/my_color</item>
</style>

[EDIT]

See GitHub demo here


Use Widget.AppCompat.Button.Colored as a parent for your style.

<style name="RedButton" parent="Widget.AppCompat.Button.Colored">
    <item name="android:textColor">@color/white</item>
    <item name="colorButtonNormal">@color/red</item>
</style>

Use android:theme, not style in buttons definitions:

<Button android:theme="@style/RedButton"/>

See AppCompat v21 > Theming and Android Support Library v22.1 - AppCompat blog posts. (note on second post, android:theme is supported on API11-, it just doesn't do automatic inheritance from parent, you will have to specify it on each child, not an issue here but worth mentioning - see Chris Banes' post on that).


Put the xml line below in your "AppTheme" xml, rather than trying to set it from the "AppTheme.Button". This works for me on v22.1.1 with non-lollipop devices. I'm guessing this is a bug because your solution above works fine for lollipop.

<item name="colorButtonNormal">@color/my_color</item>

Ensure your Activity is extending AppCompatActivity, otherwise it won't handle appCompat styles properly.

  • class: android.support.v7.app.AppCompatActivity
  • Gradle: compile 'com.android.support:appcompat-v7:23.0.1'

Use:

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
  <item name="buttonStyle">@style/AppTheme.Button</item>
</style>

remove the android: