I'm trying to use a Button widget with a top compound drawable to implement
a classic labelled button design. When I assign a stateful drawable (a
StateListDrawable), I find that the drawable doesn't change in response to
changes in the button's pressed state.
Looking at the source code for TextView, I see that it doesn't call
setCallback() on the compound drawables, so I'm guessing that this is the
reason, but is this by design, or is it a bug?

My layouts and resources are  very simple:

>>>>>> btn_rotate.xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android";>
<item android:state_pressed="true"
android:drawable="@drawable/btn_rotate_pressed" />
    <item android:state_enabled="false"
android:drawable="@drawable/btn_rotate_normal" />
    <item android:drawable="@drawable/btn_rotate_normal" />
</selector>


>>>>>> main.xml

...
<Button
  android:id="@+id/rotate"
  android:layout_width="0px"
  android:layout_height="fill_parent"
  android:layout_weight="1.0"
  android:text="@string/control_rotate"
  android:drawableTop="@drawable/btn_rotate"
  style="@style/control"
/>
...

Tom.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to