//给ListView设置动画
mListView.setLayoutAnimation(InLayoutAnim.getAnimationController(300));
public static LayoutAnimationController getAnimationController(int mDuration) {
int duration = 300;
if(mDuration>300)
duration=mDuration;
AnimationSet set = new AnimationSet(true);
Animation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(duration);
set.addAnimation(animation);
animation = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 1.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, 0.0f);
animation.setDuration(duration);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f);
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);
return controller;
}