Is it possible to set animation-list
drawable to autostart after inflating from XML without using AnimationDrawable.start()
?
My animation-list
:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/download_light" android:duration="200" />
<item android:drawable="@drawable/download20" android:duration="200" />
<item android:drawable="@drawable/download40" android:duration="200" />
<item android:drawable="@drawable/download60" android:duration="200" />
<item android:drawable="@drawable/download80" android:duration="200" />
<item android:drawable="@drawable/download_on" android:duration="300" />
</animation-list>
you can set AnimationDrawable as ProgressBar android:indeterminateDrawable, then AnimationDrawable will start automatically when ProgressBar become visible
<ProgressBar
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:minWidth="1dp"
android:minHeight="1dp"
android:maxWidth="10000dp"
android:maxHeight="10000dp"
android:indeterminate="true"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/indeterminate_progess_animation_drawable" />
After test on some device with different API, I found:
Without using AnimationDrawable.start()
animation-list
will not auto start Therefore, I think we should always use AnimationDrawable.start()
and AnimationDrawable.stop()
for start/stop animation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With