alpha animation and Close - Android Animation

Android examples for Animation:Alpha Fly Animation

Description

alpha animation and Close

Demo Code


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

import android.os.Handler;
import android.view.View;
import android.view.animation.DecelerateInterpolator;

public class Main {
    private static Handler mHandler = new Handler();

    public static void alphaClose(final View desView) {
        if (android.os.Build.VERSION.SDK_INT < 11) {
            desView.setVisibility(View.GONE);
            return;
        }/*from  w w w . ja v a 2 s. c  o  m*/
        desView.animate().setInterpolator(new DecelerateInterpolator())
                .alpha(0f).setListener(new AnimatorListener() {

                    @Override
                    public void onAnimationStart(Animator animation) {

                    }

                    @Override
                    public void onAnimationRepeat(Animator animation) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        desView.setVisibility(View.GONE);
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {

                    }
                }).setDuration(750).start();
        mHandler.postDelayed(new Runnable() {

            @Override
            public void run() {
                desView.setVisibility(View.GONE);
            }
        }, 700);
    }
}

Related Tutorials