I saw a few examples of using an ObjectAnimator to rotate and scale an ImageView.
However I want to rotate and scale a Drawable for API below 21 (So I cannot use AnimatedVectorDrawable).
It doesn't have setRotation and setScaleX like an ImageView has.
Do I have any simple way to achieve this?
rotationObjectAnimator = ObjectAnimator.ofFloat(rotationDrawable, "rotation", 0f, 360f);
rotationObjectAnimator.setDuration(1000); // miliseconds
rotationObjectAnimator.start();
scaleObjectAnimator =
ObjectAnimator.ofPropertyValuesHolder(
scaleDrawable,
PropertyValuesHolder.ofFloat("scaleX", 0.5f),
PropertyValuesHolder.ofFloat("scaleY", 0.5f));
final AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(rotationObjectAnimator, scaleObjectAnimator);