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