Possible Duplicate:
Android: Animation Position Resets After Complete
I'm using RotateAnimation
to rotate an ImageView
. The code is simple:
this.button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Animation ani = new RotateAnimation(
0, /* from degree*/
30, /* to degree */
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
ani.setDuration(1000);
imageView.startAnimation(ani);
}
});
You can see I want the imageView rotate 30 degree.
It works, but when rotating is done, the image go back to the original state, the same position and degree before rotating. I want to fix ImageView at last Animation position i.e want to fix the image tilted by 30 degree. How to fix it?
I just find an solution:
ani.setFillAfter(true);
It works :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With