AnimationDrawableを使用して6つの画像を表示しました。アニメーション化に成功しました。
しかし、それは同じ場所をアニメートするだけです。
しかし、次のフレームが表示されているときに前に進む必要があります。どうすれば表示できますか。
私のコードは。、
<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="@drawable/frog" android:duration="50" />
<item android:drawable="@drawable/frog1" android:duration="50" />
<item android:drawable="@drawable/frog2" android:duration="50" />
<item android:drawable="@drawable/frog3" android:duration="50" />
<item android:drawable="@drawable/frog4" android:duration="50" />
<item android:drawable="@drawable/frog5" android:duration="50" /> </animation-list>
private void animate() {
ImageView imgView = (ImageView) findViewById(R.id.animationImage);
// imgView.setVisibility(ImageView.VISIBLE);
imgView.setBackgroundResource(R.drawable.ani);
AnimationDrawable frameAnimation = (AnimationDrawable) imgView
.getBackground();
if (frameAnimation.isRunning()) {
frameAnimation.stop();
b.setText("Start");
} else {
frameAnimation.start();
b.setText("Stop");
}
}
次のフレームを表示すると、前方に移動します。plsは私を助けます。