Android examples for Animation:Translate Animation
start Translate Animation Expand
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 startTranslateAnimationExpand(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(0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); Animation alpha = new AlphaAnimation(0, 1); AnimationSet as = new AnimationSet(true); as.addAnimation(s_aniAnimation);// w ww . ja va2 s . co m as.addAnimation(animation); as.addAnimation(alpha); as.setDuration(duration); as.setFillAfter(true); as.setStartOffset(offset); as.setInterpolator(new OvershootInterpolator(2F)); view.startAnimation(as); // moveViewCenterTo(view, end.x, end.y); } }