Created
November 21, 2010 21:30
-
-
Save mikeplate/709171 to your computer and use it in GitHub Desktop.
Animation sample for Android
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
AnimationSet set = new AnimationSet(true); | |
Animation animation = new AlphaAnimation(0.0f, 1.0f); | |
animation.setDuration(100); | |
set.addAnimation(animation); | |
animation = new TranslateAnimation( | |
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, | |
Animation.RELATIVE_TO_SELF, -1.0f, Animation.RELATIVE_TO_SELF, 0.0f | |
); | |
animation.setDuration(2000); | |
set.addAnimation(animation); | |
LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f); | |
ViewGroup view = (ViewGroup)getWindow().getDecorView(); | |
if (view.getChildCount() == 1 && (view.getChildAt(0) instanceof LinearLayout)) { | |
LinearLayout layout = (LinearLayout)view.getChildAt(0); | |
layout.setLayoutAnimation(controller); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment