i've display six images using AnimationDrawable. It was successfully animated.
But it only animate same place.
But i need move forward when next frame is showing. How can i show it.
My code is.,
<?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");
}
}
When showing the next frame, it move forward location. Pls help me.