[英]Rewinding animation drawable using drag left/right
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();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.