In Android\'s ListView
widget, the ListView
will hold the views which is got from getView
method of an Adapter in a inner class
In my opinion @nekavally offers the best solution. I have a ListView
and a SimpleCursorAdapter
. Sometimes I need to change the size of the list items. But since the adapter recycles the views, they may appear in the wrong way. So I'm just calling mListView.invalidateViews()
after reclaiming the recycled views, and it works just fine.
startAnimation(initialHeight, finalHeight, duration, new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
childView.getLayoutParams().height =
(Integer) animation.getAnimatedValue();
childView.requestLayout();
if (animation.getAnimatedFraction() == 1f) {
mListView.reclaimViews(new ArrayList());
mListView.invalidateViews();
}
}
});