Android examples for Animation:Slide Animation
Animates a view sliding in from the left
//package com.java2s; import android.view.View; import android.view.animation.Animation; import android.view.animation.TranslateAnimation; public class Main { private static final int ANIMATION_SPEED = 100; public static void slideInLeft(View view) { slideInLeft(view, ANIMATION_SPEED); }//from w w w .ja va 2 s . c om /** * Animates a view sliding in from the left * @param view */ public static void slideInLeft(final View view, int duration) { final Animation inLeft = new TranslateAnimation(view.getX() - view.getWidth(), 0, 0, view.getX()); inLeft.setDuration(duration); view.startAnimation(inLeft); } }