On Mon, Oct 10, 2011 at 6:54 AM, dashman <[email protected]> wrote:
> I've got a ListView and for each item I display a selector image
> button
> defined similar to below:
>
> <?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/flag_clear2" />
>     <item android:drawable="@drawable/flag_clear1" />
>  </selector>
>
>
> I thought I could load the drawable from the resource file once and I
> would assign the drawable to each item in the list.
>
> That doesn't work because it seems all the items are sharing the
> same instance and causes problems. When clicking on one - all
> of the image buttons hilight.

Sounds like you need to mutate your drawable:

http://android-developers.blogspot.com/2009/05/drawable-mutations.html

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

Warescription: Three Android Books, Plus Updates, One Low Price!

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