ImageView something = (ImageView)findViewById(R.id.my_animated_image_view); something.setVisibility(View.INVISIBLE); ((AnimationDrawable)something.getDrawable()).stop(); // <-- Is this line redundant?
In my case, i have a bunch of animations of which only one runs/is visible, and right now I’m calling setVisibility() and stop() on all of them. Might get faster if i don’t need to call stop() on my own?
From
AnimationDrawablesource:So if you apply setVisible(false,false) to the
AnimationDrawablethen the animation will stop. But not when you apply it to theView. If you want the animation to go smooth then try AnimationDrawable.setVisible(false,false) and if you want your view Invisible don’t make it invisible cause a lot of UI stuff happens then. Try setting an Alpha animation ,make it transparent and setFillAfter(true). When the animations end call view tosetVisibility(View.Invisible)where is needed. This probably with give you some FPS. But generally consider overall what UI stuff happen when you animate. Avoid GC calls and view invalidations