UPDATE: Solution found! Scroll down for my accepted answer!
I want to animate multiple elements of one image and link the animation to ViewPagers po
I believe you can't do this with the AnimatedVectorDrawable/AnimatedVectorDrawableCompat programmatically.
A workaround is to use a Level List drawable and animate its levels: but you'll need lots of images for the levels to simulate the smooth transition, I'm using just three levels here for demonstration.
First you'll define the drawable level list like this:res/drawable/my_level_list.xml
Then in the layout file:
Then in your activity:
int MIN_LEVEL=0;
int MAX_LEVEL=2;
ImageView img=(ImageView)findViewById(R.id.img);
Drawable myLevelSetDrawable= img.getDrawable();
ObjectAnimator anim=ObjectAnimator.ofInt(myLevelSetDrawable,"level",MIN_LEVEL,MAX_LEVEL);
anim.setInterpolator(new BounceInterpolator());
AnimatorSet set=new AnimatorSet();
set.play(anim);
set.setDuration(1000);
set.start();
Hope that helps.