我正在制作框架以进行框架动画。我的问题是我在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