undo Fade Out To Bottom Animation - Android Animation

Android examples for Animation:Fade Animation

Description

undo Fade Out To Bottom Animation

Demo Code


//package com.java2s;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;

import android.view.View;

import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;

public class Main {
    private static final int ANIMATE_DURATION = 700;
    private static final Interpolator ANIMATE_INTERPOLATOR = new AccelerateDecelerateInterpolator();

    public static void undoFadeOutToBottom(final View v) {
        v.setLayerType(View.LAYER_TYPE_HARDWARE, null);

        v.animate().translationY(0).alpha(1).setDuration(ANIMATE_DURATION)
                .setInterpolator(ANIMATE_INTERPOLATOR)
                .setListener(new AnimatorListenerAdapter() {
                    @Override//from w  w w .  j a v  a 2 s.co  m
                    public void onAnimationEnd(Animator animation) {
                        v.setLayerType(View.LAYER_TYPE_NONE, null);
                        super.onAnimationEnd(animation);
                    }
                }).start();
    }
}

Related Tutorials