It seems like the selector always takes the first matching item. As your first item does not have any conditions, it will always be taken. You can fix the problem by simply moving your default item to the last spot.
I guess you copied the code from the ImageButton documentation. So ff some of the framework developers could state that my previous assumption was true, i can create a patch to fix and clarify the above consumption. On 7 Okt., 21:17, sdphil <[email protected]> wrote: > I cannot seem to get theselectorto work - even inside a normal > view. is there some trick to getting theselectorto work? I have > google'd for examples and tutorial and looked at > --http://dev.android.com/reference/android/widget/ImageButton.html, but > I cannot get the view to change when I set the focus there. argh... > > On Oct 7, 11:32 am, sdphil <[email protected]> wrote: > > > > > i am having trouble getting aselectorto work inside a button on an > > app widget. > > > my app widget xml looks like this: > > > <ImageButton android:id="@+id/MyImageButton" > > android:layout_width="wrap_content" > > android:layout_height="fill_parent" > > android:src="@drawable/my_selector" > > android:background="@color/transparent"/> > > > my_selector.xml in my drawable directory looks like this: > > > <selectorxmlns:android="http://schemas.android.com/apk/res/android"> > > <item android:drawable="@drawable/MyNormalButton" /> > > <item android:state_focused="true" android:state_pressed="false" > > android:drawable="@drawable/MyFocusButton" /> > > <item android:state_focused="true" android:state_pressed="true" > > android:drawable="@drawable/MyFocusButton" /> > > <item android:state_focused="false" android:state_pressed="true" > > android:drawable="@drawable/MyFocusButton" /> > > </selector> > > > the button doesn't change appearance.... > > > any ideas? > > > tia. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

