0

is it possible to animate each state of <animated-selector>?

for example, in this part of code, I want active state also animate (I know that transition can animate between states but I want each state animate too, no matter whether programmatically or by XML).

in this case assume that animatable_src1 is an animatable vector drawable

<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
    android:id="@+id/middle"
    android:drawable="@drawable/animatable_src1"
    android:state_activated="true" />

<item
    android:id="@+id/done"
    android:drawable="@drawable/simple_drawable" />

<transition
    android:drawable="@drawable/anim_done_to_middle"
    android:fromId="@+id/done"
    android:toId="@+id/middle" />

<transition
    android:drawable="@drawable/anim_middle_to_done"
    android:fromId="@+id/middle"
    android:toId="@+id/done" />

</animated-selector>

If this is not possible, can I get drawable of specific state as AnimatedVectorDrawableCompat? (Then I can animate it)

MHP
  • 2,613
  • 1
  • 16
  • 26

0 Answers0