I have animation drawable
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:duration="70" android:drawable="@mipmap/scene00089"/>
<item android:duration="70" android:drawable="@mipmap/scene00088"/>
<item android:duration="70" android:drawable="@mipmap/scene00087"/>
<item android:duration="70" android:drawable="@mipmap/scene00086"/>
//......
Which should be played only when I drag right(normally runs) or left(reversed). I have already implemented how to play it reverse using another file with reversed animation, but the only problem i need to solve is how to play it only when i drag and stop it when dropped.
You need a view to play the animation on, so its better to make a view in your layout view hierarchy and apply the animation on it like below. hope this will help you.
image.setBackgroundResource(R.anim.cubicfacetween);
AnimationDrawable animationDrawable = (AnimationDrawable) image.getBackground();
animationDrawable.start();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.