Android examples for Animation:Translate Animation
start Translate Animation Shrink
import android.graphics.Point; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.OvershootInterpolator; import android.view.animation.ScaleAnimation; import android.view.animation.TranslateAnimation; public class Main { public static void startTranslateAnimationShrink(final View view, Point start, final Point end, int offset, int duration) { Animation animation = new TranslateAnimation(start.x - end.x, 0, start.y - end.y, 0); Animation s_aniAnimation = new ScaleAnimation(1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); Animation alpha = new AlphaAnimation(1, 0); AnimationSet as = new AnimationSet(true); as.addAnimation(s_aniAnimation);/*from w w w . jav a2 s. c o m*/ as.addAnimation(animation); as.addAnimation(alpha); as.setDuration(duration); as.setFillAfter(true); as.setStartOffset(offset); as.setInterpolator(new OvershootInterpolator(1F)); view.startAnimation(as); // moveViewCenterTo(view, end.x, end.y); } }