我正在製作框架以進行框架動畫。我的問題是我在anim xml中提供了大約10個可繪製的圖像。但只有前兩個和後兩個顯示不是所有的圖像。我也在這張圖片上做翻譯。翻譯後只有框架動畫開始了。翻譯正在發生,框架動畫也在發生,但它並沒有顯示所有的框架。這是我的anim xml。只顯示frog_01和frog_02。框架動畫中未顯示某些框架
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true" >
<item
android:drawable="@drawable/frog_01"
android:duration="70"/>
<item
android:drawable="@drawable/frog_02"
android:duration="70"/>
<item
android:drawable="@drawable/frog_03"
android:duration="70"/>
<item
android:drawable="@drawable/frog_04"
android:duration="70"/>
<item
android:drawable="@drawable/frog_05"
android:duration="70"/>
<item
android:drawable="@drawable/frog_04"
android:duration="70"/>
<item
android:drawable="@drawable/frog_03"
android:duration="70"/>
<item
android:drawable="@drawable/frog_02"
android:duration="70"/>
<item
android:drawable="@drawable/frog_01"
android:duration="70"/>
</animation-list>
這裏是我使用的翻譯和幀動畫
public void frogAnim() {
frogView.clearAnimation();
final TranslateAnimation fslide2 = new TranslateAnimation(10, 65, 0, 0);
fslide2.setDuration(400);
fslide2.setFillAfter(true);
fslide2.setAnimationListener(fanimationListener1);
frogView.startAnimation(fslide2);
c = false;
}
AnimationListener fanimationListener1 = new AnimationListener() {
public void onAnimationEnd(Animation arg0) {
c = true;
frogView.setBackgroundResource(R.drawable.frog_movement);
frogFrameAnimation = (AnimationDrawable) frogView.getBackground();
frogFrameAnimation.start();
playAudioFileListener(R.raw.frog, player);
CountDownTimer count = new CountDownTimer(200, 700) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
frogFrameAnimation.stop();
titileAnimMusic(R.drawable.frog_title,
R.anim.alpha_fade_in1, R.raw.vo_child_frog, player);
}
};
count.start();
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationStart(Animation animation) {
}
};
你試過這個....... – kavya
我試了這個,仍然有問題.....請檢查我的代碼(不使用你的代碼)我已經更新了我的文章..... – Aju
我找到了解決方案,我們不應該在翻譯動畫之後調用幀動畫。 .. – Aju