Last active
August 29, 2015 14:24
-
-
Save viizki/4312306b8a55c97a51a2 to your computer and use it in GitHub Desktop.
Animation For ListView
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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