I have a kinda complex vector drawable that I want to animate. I used @RomanNurik\'s web tool to create the animation from a svg
That gives me a valid
I have the same issue so I did this:
// setup and set animation
AnimatedVectorDrawableCompat animatedVector = AnimatedVectorDrawableCompat.create(context, R.drawable.listening_vector_anim);
imageView.setImageDrawable(animatedVector);
// loop animation!
new Thread(() -> {
while (imageView.isAttachedToWindow()) {
try {
imageView.post(() -> animatedVector.start());
Thread.sleep(2000); //depends on your animation duration
} catch (Exception e) {
e.printStackTrace();
}
}
}).start();
This thread will die when the ImageView detach from window.