简体   繁体   中英

Android: Avoid view invalidate when only layout is changed

When animating height of an item in ListView , the setViewValue() method in the ViewBinder is called several times for each layout change, making the animation very slow.

I am currently solving it by setting a disableViewUpdate flag in onAnimationStart() and turning it off in onAnimationEnd() . setViewValue() returns true if the flag is set, avoiding any database lookup. But there are still tens or hundreds of calls to setViewValue() during each animation step.

My question is: Is there a way to avoid setViewValue() being called as a result of layout changes?

I would just go for inheriting from ListView, overriding the method and then avoiding any action when the method is called and the view is animating.

Hope this helps :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM