Closed MoonJR closed 6 months ago
This behavior may seem surprising but it has nothing to do with Lottie,. If you set a view to gone but it has an animation, Android will add it to a list of disappearing views that will be removed only when the animation finishes (source).
To validate this, I copied your code and could repro what you see. I then replaced the Lottie animation with a plain View that was a red square and the exact same thing happened.
LottieAnimationView's Parent View After Applying Alpha Animation
When changing the visibility of the LottieAnimationView during the animation of the parent view, the animation pauses, but the view itself continues to linger on the screen as an afterimage.
When the visibility is set to 'gone,' and a layout inspection is performed, the view appears to be removed, but an afterimage persists.
xml
code