开发者

How to update a single row of a ListView with animation?

I have a ListView with several rows, and the user can start async tasks by pressing buttons on these rows. When a task is started, the corresponding row should show some "Loading" View, and when the task finishes, the row should show the results of that async task.

Functionally, everything is working currently. But I'd like to switch a row's state using animations. Right now, I always call .onDataSetChanged() on the ListView's adapter when a row's state has to change (e.g. Loading -> 开发者_运维知识库Some content). But this reloads/redraws the whole ListView.

I only want to modify a single row, and I'd like to do it with a nice animation. AFAIK, you always have to call .onDataSetChanged() on the adapter, whenever the data behind the ListView changes, or else you get an Exception.

So is it possible to somehow load new data into a ListView row, and present it with animation (that affects only the modified row)?

Thanks


Well 1 way to do it was select the child view and add the animation to that view. And when the animation is done you could update the values for the view. Something like getListView.getChildAt(index).startAnimation(anim);

And add a animation listener to 'anim' so you can update the values when the animation ends.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜