I have a button style with a blue background that works fine in API 22, but the same button appears in dark grey without the applied style in Android 4. This is my style:
<style name="MyApp.Plain" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">@drawable/background</item>
<item name="android:buttonStyle">@style/MyApp.Widget.Button</item>
</style>
<style name="MyApp.Widget.Button" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/btn_blue</item>
<item name="android:focusable">true</item>
<item name="android:clickable">true</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">#fff</item>
<item name="android:gravity">center_vertical|center_horizontal</item>
</style>
My btn_blue.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_disabled" android:state_enabled="false"/>
<item android:drawable="@drawable/btn_pressed" android:state_enabled="true" android:state_pressed="true"/>
<item android:drawable="@drawable/btn_normal_blue" android:state_enabled="true"/>
</selector>
and btn_normal_blue.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="90"
android:endColor="#368ac6"
android:startColor="#0e58a4" />
<corners android:radius="20dp" />
</shape>
What could be the reason for this behavior and how can I fix this?
EDIT: This does not work with support v7:22.2.0, but does work with v7:21.0.3. I didn't change anything besides the dependency and changed AppCompatActivity to ActionBarActivity.
Possibly this is an Android bug.