I am having the same issue where my animations for specific items
within a listview are random where they shouldn't be.  In my
application the user should be able to swipe any listview element from
left to right and it would slide off screen.  However, when this
action is done a random item within the listview does the animation
and not the selected one.  I am implementing the ViewHolder method of
the sample List14.java from the API demos.  Does anyone know why this
random behavior occurs for animations within listViews and how to
overcome it?

On Jun 25, 4:36 pm, "Alec B. Plumb" <[email protected]> wrote:
> ListViewrecycles 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 aListView.
> > 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: theListViewuses 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 theListViewis
> > 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 theanimationis done.
>
> > Does anyone have any ideas on how to make a temporary fading
> > background on particular rows in aListView?

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