animate View Fade Out Animator - Android android.animation

Android examples for android.animation:Animator Fade

Description

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);
    }// ww w  .ja va2  s .c om

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

Related Tutorials