fade to hide View - Android Animation

Android examples for Animation:Fade Animation

Description

fade to hide View

Demo Code


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

public class Main {
    public static void fade_GONE(final View view) {
        fade_GONE(view, 500);/*ww  w. ja  v a  2 s.  c o m*/
    }

    public static void fade_GONE(final View view, int duration) {
        view.animate().alpha(0.0f).setDuration(duration)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        view.setVisibility(View.GONE);
                    }
                });
    }
}

Related Tutorials