fade Out To Bottom - Android Animation

Android examples for Animation:Fade Animation

Description

fade Out To Bottom

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 fadeOutToBottom(final View v, View main) {
        v.setLayerType(View.LAYER_TYPE_HARDWARE, null);

        v.animate().translationYBy(main.getHeight() / 2).alpha(0)
                .setDuration(ANIMATE_DURATION)
                .setInterpolator(ANIMATE_INTERPOLATOR)
                .setListener(new AnimatorListenerAdapter() {
                    @Override/*ww w . j a  va  2s. c  om*/
                    public void onAnimationEnd(Animator animation) {
                        v.setLayerType(View.LAYER_TYPE_NONE, null);
                        super.onAnimationEnd(animation);
                    }
                }).start();
    }
}

Related Tutorials