Disabling animations of list items in a ListView
<p>I've got a listview row defined in two parts within a ViewFlipper. With a 'more' button to display the second part and 'less' button to bring back the first part. Everything works fine except that when I scroll after having clicked the 'more' button, some other rows are also showing the second part. I believe this is because the listview is reusing the View. </p>

<p>Note that I can't assign a new View object to every row. This causes some serious stuttering during scroll since there's a lot of work being done with the creation of the OnClickListeners.</p>

<p>I've come up with a solution, but the listview scrolling still stutters as it comes across rows that need to be put back into 'first' position. Basically, I change the animation to be zero length.</p>

<p>I have tried .clearAnimation() + setDisplayedChild(), but that doesn't seem to do anything to the animation already in place -- that is, it still plays the animation.</p>

<p>Is there a better approach that would eliminate the stutter?</p>

<p>current code:</p>

<pre><code>public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null){
    final ViewFlipper vf = (ViewFlipper)getInflatedView(parent.getContext());

    Button btnMore = (Button)vf.findViewById(R.id.btnMore);
    btnMore.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View arg0) {
            vf.setInAnimation(animInFromRight());
            vf.setOutAnimation(animOutToLeft());
            vf.showNext();
        }
    });

    Button btnLess = (Button)vf.findViewById(R.id.btnLess);
    btnLess.setOnClickListener(new OnClickListener(){
        @Override
        public void onClick(View v) {
            vf.setInAnimation(animInFromLeft(500));
            vf.setOutAnimation(animOutToRight(500));
            vf.showPrevious();
        }
    });
    convertView = vf;
}else{
    ViewFlipper vf = (ViewFlipper)convertView;
    if (vf.getDisplayedChild() != 0){
        vf.setInAnimation(animInFromLeft(0));
        vf.setOutAnimation(animOutToRight(0));
        vf.showPrevious();
    }
}
      return convertView;
}
</code></pre>
