fragment Slide Top In - Android Animation

Android examples for Animation:Slide Animation

Description

fragment Slide Top In

Demo Code


//package com.java2s;
import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;

import android.view.animation.TranslateAnimation;

public class Main {
    public static TranslateAnimation fragmentSlideTopIn(int duration) {
        TranslateAnimation translateAnimation = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF, 0f, Animation.RELATIVE_TO_SELF,
                0f, Animation.RELATIVE_TO_SELF, -1f,
                Animation.RELATIVE_TO_SELF, 0f);
        translateAnimation//from  w ww  . j  a  va  2  s. c  om
                .setInterpolator(new DecelerateInterpolator(1.3f));
        translateAnimation.setDuration(duration);
        translateAnimation.setFillAfter(true);

        return translateAnimation;
    }
}

Related Tutorials