Java 使用左/右拖动回放可绘制的动画
我有可以画的动画Java 使用左/右拖动回放可绘制的动画,java,android,animation,kotlin,drag,Java,Android,Animation,Kotlin,Drag,我有可以画的动画 <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:duration="70" android:drawable="@mipmap/scene00089"/> <item andr
<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"/>
//......
//......
仅当我向右拖动(正常运行)或向左拖动(反转)时才应播放。
我已经实现了如何使用另一个具有反向动画的文件反向播放动画,但我需要解决的唯一问题是如何仅在拖动时播放动画,并在拖放时停止播放。您需要一个视图来播放动画,因此最好在布局视图层次结构中创建一个视图,并在其上应用动画,如下所示。 希望这对你有帮助
image.setBackgroundResource(R.anim.cubicfacetween);
AnimationDrawable animationDrawable = (AnimationDrawable) image.getBackground();
animationDrawable.start();
我有这个。但我只需要当我把手指放在屏幕上时才能播放动画