ListView recycles rows by calling getView(int position, View
convertView, ViewGroup  parent) in the ListAdapter. The convertView
argument can be an existing view that will be moved to the new
position. The ListAdapter will usually keep the convertView (instead
of creating a new one) and modify it to display information for the
new position. I am guessing that you are using a standard list adapter
that doesn't know about your animations.

You could subclass the ListAdapter and override getView() to make sure
than any animations are in the appropriate state when the view gets
repurposed.

On Jun 25, 8:58 am, Daniel Lew <[email protected]> wrote:
> Back when I originally wrote my app, I thought I could use some tricks
> with TransitionDrawable to briefly highlight some rows in a ListView.
> However, when I actually implemented this (a fading background), the
> background would jump from item to item randomly.
>
> As my knowledge of Android has progressed, I've learned why this no
> longer works: the ListView uses optimizations and actually shuffles
> rows around, so the row that I may have originally told to animate
> ends up placed in a different spot by the time the ListView is
> visible.
>
> My question is whether there's a solution to this problem.  I've
> thought of using a different view type, but that would only work if I
> can turn *off* the view type for that row at the right time; since I'm
> using a TransitionDrawable, there's no way for me (right now) to mark
> once the animation is done.
>
> Does anyone have any ideas on how to make a temporary fading
> background on particular rows in a ListView?

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