android - Preventing overlapping layout animations on a ListView -


i have listview has layout animation fades in each item 1 @ time.

  lac = new layoutanimationcontroller(animationutils.loadanimation(this, r.anim.listview_2), 0.25f);     listoptions.setlayoutanimation(lac);     listoptions.setlayoutanimationlistener(new animation.animationlistener() {         @override         public void onanimationstart(animation animation) {         }          @override         public void onanimationend(animation animation) {         }          @override         public void onanimationrepeat(animation animation) {         }     }); 

when user selects item, listview displays new set of items - each fading in 1 @ time. however, if fade in animation of items has not completed when user selects item , causes new set fade in, these animations overlap causing , previous items can seen while new ones fading in. looks blinking glitch on listview.

onitemclick(), if call listview.getlayoutanimation.getanimation().cancel(); still same blinking problem. have tried listview.clearanimation();, still didn't work. have tried: listview.setlayoutanimation(null); , resetting. still didn't work.

it appears unable stop or cancel animation! want is, onitemclick() in listview, stop animation or empty / clear listview reload new items listview , fade them in using animation, no overlap - , therefore - no blinking glitch.

i not want disable listview until animation completes, re-enable, because can create awkwardly long wait times.

animation in listviews challenging 1 of reasons google released recyclerview. however, video may have clues how make work you: https://www.youtube.com/watch?v=8mifsxgshis


Comments