Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

buttonStyle not working for 22.1.1

I´m Using com.android.support:appcompat-v7:22.1.1

This attribute android:buttonStyle is not setting that style for every button, I need to set android:theme="@style/AppTheme.Button" manually on each button.

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

What do I need to do to set a general style for it?

like image 415
Daniel Gomez Rico Avatar asked Apr 26 '15 19:04

Daniel Gomez Rico


2 Answers

Use buttonStyle insteadof android:buttonStyle in your theme

like image 100
LenaYan Avatar answered Oct 16 '22 16:10

LenaYan


Similar to @danielgomezrico answer but without having two style files:

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">

    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <!-- android:buttonStyle for v21+ and buttonStyle for the rest -->
    <item name="buttonStyle">@style/MyCustomButton</item>
    <item name="android:buttonStyle">@style/MyCustomButton</item>
    <item name="colorButtonNormal">@color/my_color_accent</item>
</style>

<style name="MyCustomButton" parent="Base.Widget.AppCompat.Button">
    <item name="android:textColor">#ffffff</item>
</style>

like image 31
Ana María Martínez Gómez Avatar answered Oct 16 '22 16:10

Ana María Martínez Gómez