set Translate Animation to a View - Android Animation

Android examples for Animation:Translate Animation

Description

set Translate Animation to a View

Demo Code


//package com.java2s;

import android.view.View;

import android.view.animation.TranslateAnimation;

public class Main {

    public static void setTranslateAnimation(View v, int time, int x1,
            int x2, int y1, int y2) {
        TranslateAnimation animation = new TranslateAnimation(x1, x2, y1,
                y2);//www  .j ava  2  s  . c  o  m
        animation.setDuration(time);
        v.setAnimation(animation);
    }
}

Related Tutorials