Android: show/hide a view using an animation

后端 未结 9 2068
青春惊慌失措
青春惊慌失措 2021-01-30 00:53

I\'ve been looking through many google results / questions on here to determine how to show/hide a view via a vertical animation, but I can\'t seem to find one that\'s exactly r

9条回答
  •  佛祖请我去吃肉
    2021-01-30 01:16

    Try this.

    view.animate()
        .translationY(0)
        .alpha(0.0f)
        .setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                view.setVisibility(View.GONE);
            }
        });
    

提交回复
热议问题