>
> Sure, in the onPressed event, change the image, when it's not pressed,
> change it back.?
>

Or you can do it with a selector....  If you save the following xml to a
file called btnImage.xml:

<?xml version="1.0" encoding="utf-8"?>
<selector
    xmlns:android="http://schemas.android.com/apk/res/android";
    android:constantSize="true">

    <item android:state_pressed="true"
android:drawable="@drawable/pressed_image" />
    <item android:drawable="@drawable/normal_image" />
</selector>

Then you would just set the image of your button to your selector drawable:

Code: btn.SetImageResource(R.drawable.btnImage);
XML: android:src="@drawable/btnImage"

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Jun 20, 2012 at 9:45 AM, Kristopher Micinski <[email protected]
> wrote:

> On Wed, Jun 20, 2012 at 11:38 AM, Mark Murphy <[email protected]>
> wrote:
> > Or take a peek at ToggleButton, or create your own CompoundButton.
> >
> > BTW, we are assuming that by "pressed" you mean a persistent status
> > change (what Android refers to as "checked"), as in a CheckBox or
> > RadioButton..
> >
>
> Ah, I actually assumed the other way, otherwise I would have pointed
> him at ToggleButton :-)
>
> kris
>
> --
> 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
>

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

Reply via email to