What I have missed is to set the height
of the ListView, after the top
property was modified. Without this the ListView will hold the same old height, which is the reason that no additional items will be shown.
I switched to a ValueAnimator, because there is no need for an additional setter for the height
in a CustomListView class.
Code is like this:
public void animateListHeight() {
PropertyValuesHolder topList = PropertyValuesHolder.ofInt("top", mListView.getTop(), 5);
ValueAnimator animList = ValueAnimator.ofPropertyValuesHolder(topList);
animList.setDuration(300L);
AnimatorUpdateListener listUpdater = new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int top = ((Integer)animation.getAnimatedValue("top")).intValue();
mListView.setTop(top);
ViewGroup.LayoutParams params = (ViewGroup.LayoutParams) mListView.getLayoutParams();
params.height = mListView.getBottom() - top;
mListView.setLayoutParams(params);
}
};
animList.addUpdateListener(listUpdater);
animList.start();
}