I have the following Button style:
<style name="ButtonmyTimeRed" parent="android:Widget.Button">
<item name="android:minHeight">48dip</item>
<item name="android:minWidth">64dip</item>
<item name="android:textColor">#ffffff</item>
<item name="android:background">@drawable/button_selector_red</item>
</style>
<style name="ImageButtonmyTimeRed" parent="android:Widget.ImageButton">
<item name="android:background">@drawable/button_selector_red</item>
</style>
with the following selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<!--<item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/button_shape_red" />-->
<!--<item android:state_window_focused="false" android:state_enabled="false" android:drawable="@drawable/button_shape_disabled" />-->
<!--<item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/button_shape_red" />-->
<item android:drawable="@drawable/button_shape_red_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/button_shape_red" android:state_focused="true"/>
<item android:drawable="@drawable/button_shape_disabled" android:state_enabled="false" />
<!--<item android:drawable="@drawable/button_shape_red" android:state_enabled="true" />-->
<item android:drawable="@drawable/button_shape_red"/>
</selector>
My shape looks like:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="@color/red" />
</shape>
Everything works fine on Api level 14 and above. I don't have custom values-xx folders, so I'm wondering why my button has no background on the API 10 device.
My base theme is: Theme.AppCompat.Light and I'm using: compile 'com.android.support:appcompat-v7:22.0.0'
The strange thing is that my ImageButton has the correct background.
UPDATE: Seems "solid" does not work on onlder devices. When I put:
<stroke
android:width="3dp"
android:color="@color/red" />
<solid android:color="@color/red" />
I get a red border but no background