Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android textview blinking after changing its visibility using animation [duplicate]

I have some views in the constraint layout. I used animation to reveal and hide the view. When the view is GONE, it blinks for a second and become visible and then gone.

     view.animate()
    .alpha(0.0f)
    .setDuration(300)
    .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(View.GONE);
        }
    });
like image 229
jk multi Avatar asked Oct 24 '25 21:10

jk multi


1 Answers

I tried your posted code and it seems to work just fine, except when animateLayoutChanges is turned on for the parent of the view you are trying to animate. If you have that enabled in the layout xml, turn it off and try again.

like image 56
Dark Byte Avatar answered Oct 26 '25 11:10

Dark Byte