get Translate X from 0 to 100 Animation - Android Animation

Android examples for Animation:Translate Animation

Description

get Translate X from 0 to 100 Animation

Demo Code


//package com.java2s;
import android.view.View;

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

public class Main {
    private static TranslateAnimation getTranslateX0To100Animation(
            View view, long duration) {
        TranslateAnimation animation = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF,
                1, Animation.ABSOLUTE, 0, Animation.ABSOLUTE, 0);
        animation.setDuration(duration);
        return animation;
    }//from  w ww. ja v a 2s.  c  o  m
}

Related Tutorials