In my application there are two xml styles.xml files defining the theme of the application, which differ for different versions of api. In one case, values-v21/styles.xml
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="AppTheme" parent="Theme.AppCompat"> <item name="colorPrimary">@color/red</item> <item name="colorPrimaryDark">@color/dark_red</item> <item name="colorAccent">@color/gray</item> <item name="android:colorBackground">@color/soothing_blue</item> <item name="android:buttonStyle">@style/BeatBoxButton</item> </style> <style name="BeatBoxButton" parent="android:style/Widget.Material.Button"> <item name="android:background">@drawable/button_beat_box</item> </style> </resources> Which works correctly (checked on android 6) and where the customized buttonStyle defined by me is applied to the buttons
and in another case, it is values/styles.xml
<resources> <style name="AppTheme" parent="Theme.AppCompat"> <item name="colorPrimary">@color/red</item> <item name="colorPrimaryDark">@color/dark_red</item> <item name="colorAccent">@color/gray</item> <item name="android:colorBackground">@color/soothing_blue</item> <item name="android:buttonStyle">@style/BeatBoxButton</item> </style> <style name="BeatBoxButton" parent="android:style/Widget.Holo.Button"> <item name="android:background">@drawable/button_beat_box</item> </style> </resources> which is used in the case of api <21 (tested on android 4.4.2). The problem is that the style of the buttons does not change and they are displayed with a standard display. If you specify directly in the file responsible for the display of the android:background="@drawable/button_beat_box" button android:background="@drawable/button_beat_box" then the required parameters are applied.
Tell me, please, what could be the problem - I don’t want to create a separate layout-21 file as this contradicts the work with styles