开发者

Android ListView animation of views inside the adapter that got updated

Im using ListView to to show some custom data, once data is updated in the adapter i call notifyDatasetChanged(), so the view will get updated, all of this works well, my issue though is i would like to run an animation once only on items that got changed when the adapter was updated. currently i keep a copy of all t开发者_如何学Gohe changed objects and i tried to animate the correct items through the getView() call.

However if i do it only once for every getView call then i see no animation most of the time on items that changed. if i continue to do so in successive getView calls i see animation on items that don not change as well and also the ones that changed get animated again and again.

Im guessing sometimes android calls the getView() for other reasons than showing the generated view immediately, and thats the reason it doesnt work if i do it once.

What is the correct way to do this?

Thanks, Totem.


If anyone is has this problem as well the way around it is to extend listview and override

onMeasure(int widthMeasureSpec, int heightMeasureSpec) 

and inside manually set the size with

setMeasuredDimension()

make sure not to call the super onMeasure() since it will call getview on all your children views with a disposeable view just to measure them.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜