Skip to content

Instantly share code, notes, and snippets.

@viizki
Last active August 29, 2015 14:24
Show Gist options
  • Save viizki/4312306b8a55c97a51a2 to your computer and use it in GitHub Desktop.
Save viizki/4312306b8a55c97a51a2 to your computer and use it in GitHub Desktop.
Animation For ListView
private LayoutAnimationController getAnimationController() int duration = 100;
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, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF, -0.5f, Animation.RELATIVE_TO_SELF, 0.0f);
animation.setDuration(duration);
set.addAnimation(animation);
LayoutAnimationController controller = new LayoutAnimationController(set, 0.2f);
controller.setOrder(LayoutAnimationController.ORDER_NORMAL);
return controller;
}
listView.setLayoutAnimation(getAnimationController());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment