Create animate View Fade Out Animator - Android android.animation

Android examples for android.animation:Animator Fade

Description

Create animate View Fade Out Animator

Demo Code


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

import android.animation.ObjectAnimator;

import android.view.View;

public class Main {
    public static Animator animViewFadeOut(View paramView) {
        return animViewFadeOut(paramView, 200L, null);
    }//  w  ww.  j  a  va  2 s .  c o m

    public static Animator animViewFadeOut(View paramView, long paramLong,
            Animator.AnimatorListener paramAnimatorListener) {
        ObjectAnimator localObjectAnimator = ObjectAnimator.ofFloat(
                paramView, "alpha", new float[] { 1.0F, 0.0F });
        localObjectAnimator.setDuration(paramLong);
        if (paramAnimatorListener != null)
            localObjectAnimator.addListener(paramAnimatorListener);
        localObjectAnimator.start();
        return localObjectAnimator;
    }
}

Related Tutorials