I need to make a custom imageview with Animation drawable.
Currently I have defined an AnimationDrawable in XML which consists of a single element and a series of nested tags
<animation-list android:id="@+id/selected" android:oneshot="false">
<item android:drawable="@drawable/wheel0" android:duration="50" />
<item android:drawable="@drawable/wheel1" android:duration="50" />
<item android:drawable="@drawable/wheel2" android:duration="50" />
<item android:drawable="@drawable/wheel3" android:duration="50" />
<item android:drawable="@drawable/wheel4" android:duration="50" />
<item android:drawable="@drawable/wheel5" android:duration="50" />
</animation-list>
and then I loaded to play the animation from the code
ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image);
img.setBackgroundResource(R.drawable.spin_animation);
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
frameAnimation.start();
I am stuck in implementing this. Can anyone help me to achieve this.
question from:
https://stackoverflow.com/questions/65867198/android-custom-imageview-with-animationdrawable 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…