Вы можете использовать https://shapeshifter.design/ для создания AnimatedVectorDrawable из простого SVG (см .: https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable)
После создания чертежа и включения его в папку активов вы можете загрузить чертеж ипередача его в ImageView, который определен в вашем XML-макете.
См. следующий код:
final AnimatedVectorDrawableCompat animatedVectorDrawableCompat =
AnimatedVectorDrawableCompat.create(getApplicationContext(),
R.drawable.animatedvector);
ImageView imageView = findViewById(R.id.imageView);
imageView.setImageDrawable(animatedVectorDrawableCompat);
final Animatable animatable = (Animatable) imageView.getDrawable();
animatable.start();
R.drawable.animatedvector
- это AnimatedVectorDrawable
, который вы хотите загрузить, а R.id.imageView
ImageView, который должен показывать AnimatedVectorDrawable
.
Надеюсь, это поможет; -)