Create translate Animation and set duration - Android Animation

Android examples for Animation:Translate Animation

Description

Create translate Animation and set duration

Demo Code


//package com.java2s;

import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

public class Main {
    public static Animation translateAnimation(int fromX, int toX,
            int fromY, int toY) {
        Animation animation = new TranslateAnimation(fromX, toX, fromY, toY);
        animation.setDuration(400);//from   w  w w  . j  a v  a2  s .c  o m
        return animation;
    }
}

Related Tutorials