How to clear animation listeners installed by NineOldAndroids?

I am trying to have an animated view in my application and am using NineOldAndroid for animation.
The desired effect is to fade out the view, and then adjust the visibility so that it is not pressed while it is invisible. This is how I do it.

ViewPropertyAnimator.animate(view).alpha(0).setListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {

            }

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

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });

The problem is that the listener adheres to the symbol above view, and when I try to extinguish it again, the listener is called again, as a result, a view appears GONEwhen it appears.

ViewPropertyAnimator.animate(enterGallery).alpha(1);

How to clear the listener after view visibility is set in the first code fragment GONE?

+4
1

, VISIBLE null .

ViewPropertyAnimator.animate(view).alpha(1).setListener(null);
+6

All Articles