Animation is an Animation effect component of android. It can display pages, ListView, and GridView in a brilliant way.
This blog briefly introduces four animation effects:
1. AlphaAnimation controls the gradient and transparent animation effect
2. ScaleAnimation controls the size scaling animation effect
3. TranslateAnimation controls the animation effect of screen translation
4. RotateAnimation controls the animation effect of image angle changes
Use the Code directly. Note: In the onCreate () method of the activity, the code I demonstrated directly loads the animation effect of ListView.
[Java] AnimationSet set = new AnimationSet (false );
Animation animation = new AlphaAnimation (); // AlphaAnimation controls the animated Effect of gradient transparency
Animation. setDuration (500); // animation time in milliseconds
Set. addAnimation (animation); // Add an animation set
Animation = new TranslateAnimation (1, 13, 10, 50); // ScaleAnimation controls the size scaling animation effect
Animation. setDuration (300 );
Set. addAnimation (animation );
Animation = new RotateAnimation (); // TranslateAnimation controls the animation effect of screen translation
Animation. setDuration (300 );
Set. addAnimation (animation );
Animation = new ScaleAnimation (5, 0, 2, 0); // RotateAnimation controls the animation effect of image angle changes
Animation. setDuration (300 );
Set. addAnimation (animation );
LayoutAnimationController controller = new LayoutAnimationController (set, 1 );
GridView gridView = (GridView) this. findViewById (R. id. gridview );
GridView. setLayoutAnimation (controller); // sets the animation effect in the GridView.
ListView listview = (ListView) this. findViewById (R. id. listview );
Listview. setLayoutAnimation (controller); // sets the animation effect for ListView.
From Scott's column