1
我有以下XML文件來定義我的幀動畫:設置一個監聽器,幀動畫
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/youme_blink_frame_0000" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0001" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0002" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0003" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0004" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0005" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0006" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0007" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0008" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0009" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0010" android:duration="40" />
</animation-list>
然後,我有以下代碼:
Animation mAnim = AnimationUtils.loadAnimation(this, R.anim.blink);
mAnim.setAnimationListener(this);
ImageView img = (ImageView)findViewById(R.id.animationImage);
img.clearAnimation();
img.setAnimation(mAnim);
img.startAnimation(mAnim);
此代碼生成異常與錯誤「未找到動畫文件」。 是不是一個框架動畫被認爲是一個動畫或者我做錯了什麼?
感謝, 西蒙
這不回答這個問題如何動畫監聽器添加到它 – ERJAN