Nathan wrote:
> The current ToggleButton extends TextView and not ImageButton, so you
> can't switch images, just text.

First, ToggleButton extends CompoundButton, like you were proposing for
your own implementation.

Second, you should be able to replace the image used by ToggleButton.

Step #1: Clone the following resources from your SDK into your project:

res/drawable/btn_toggle.xml
res/drawable/btn_toggle_bg.xml
res/drawable-*/btn_toggle_on.9.png
res/drawable-*/btn_toggle_off.9.png

Step #2: Modify btn_toggle_bg.xml to point to your @drawable/btn_toggle
rather than the built-in one.

Step #3: Change btn_toggle_*.9.png as needed

Step #4: Set btn_toggle_bg as the background of the ToggleButton, in
your layout or via a style

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training...At Your Office: http://commonsware.com/training

-- 
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