Android examples for Animation:Translate Animation
create Translate In Animation
//package com.java2s; import android.content.Context; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationSet; import android.view.animation.TranslateAnimation; public class Main { public final static int ANIMATION_IN_TIME = 500; public static Animation createInAnimation(Context context, int fromYDelta) { AnimationSet set = new AnimationSet(context, null); set.setFillAfter(true);/*from w w w. j ava2 s . c o m*/ TranslateAnimation animation = new TranslateAnimation(0, 0, fromYDelta, 0); animation.setDuration(ANIMATION_IN_TIME); set.addAnimation(animation); AlphaAnimation alphaAnimation = new AlphaAnimation(0, 1); alphaAnimation.setDuration(ANIMATION_IN_TIME); set.addAnimation(alphaAnimation); return set; } }