diff options
Diffstat (limited to 'core/java/android/widget/ImageButton.java')
| -rw-r--r-- | core/java/android/widget/ImageButton.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/widget/ImageButton.java b/core/java/android/widget/ImageButton.java index d417e40bf293..5c0517022153 100644 --- a/core/java/android/widget/ImageButton.java +++ b/core/java/android/widget/ImageButton.java @@ -44,11 +44,11 @@ import java.util.Map; * <pre> * <?xml version="1.0" encoding="utf-8"?> * <selector xmlns:android="http://schemas.android.com/apk/res/android"> - * <item android:drawable="@drawable/button_normal" /> <!-- default --> * <item android:state_pressed="true" * android:drawable="@drawable/button_pressed" /> <!-- pressed --> * <item android:state_focused="true" * android:drawable="@drawable/button_focused" /> <!-- focused --> + * <item android:drawable="@drawable/button_normal" /> <!-- default --> * </selector></pre> * * <p>Save the XML file in your project {@code res/drawable/} folder and then @@ -57,6 +57,11 @@ import java.util.Map; * based on the state of the button and the corresponding images * defined in the XML.</p> * + * <p>The order of the {@code <item>} elements is important because they are + * evaluated in order. This is why the "normal" button image comes last, because + * it will only be applied after {@code android:state_pressed} and {@code + * android:state_focused} have both evaluated false.</p> + * * <p><strong>XML attributes</strong></p> * <p> * See {@link android.R.styleable#ImageView Button Attributes}, |
