[英]Rewinding animation drawable using drag left/right
我有可繪制的動畫
<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();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.