The only thing I can think of is that the drawables in the selector are taken in the order in which listed in the XML. So it it finds a "match" for the state it will grab the first entry it finds in order.
The other thing worth trying is to put two of these buttons on a dialog and then test. Then you can see if you are having a problem with the "focused" state. -niko On Sep 24, 12:02 am, Vinay <[email protected]> wrote: > The image button background never changes (normal, focused, clicked.) > > I'm using an image button and trying to different background image > when normal, focused and clicked. I have read quite a lot of posts > related to this and have implemented exactly as suggested. My code > below: > > In main.xml: (this is just a part of my main.xml) > <ImageButton android:id="@+id/ImageButton01" > android:layout_width="wrap_content" > android:layout_height="wrap_content" > android:background="@drawable/fm" android:clickable="true" > android:focusable="true" android:layout_margin="10px"> > </ImageButton> > > fm.xml: (in folder drawable) > <?xml version="1.0" encoding="utf-8"?> > <selector > xmlns:android="http://schemas.android.com/apk/res/android"> > <!-- Default State --> > <item android:drawable="@drawable/fm_rest"/> > > <!-- Focused State --> > <item android:state_focused="true" > android:drawable="@drawable/fm_focus"/> > > <!-- Pressed State --> > <item android:state_pressed="false" > android:drawable="@drawable/fm_press"/> > > <!-- Focused Pressed State --> > <item android:state_focused="true" > android:state_pressed="true" > android:drawable="@drawable/fm_press"/> > </selector> > > Kindly let me know if I'm missing some thing. > > Also kindly let me know will the focus works in the emulator when > focused using mouse. > > Thank you. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

