working in android last couple of days and i am trying to rotate an arrow by pressing a button. Using RotateAnimation and:
setFillAfter(true);
arrow remains in last position as supposed to. But when i press button again arrow yes starts to rotate from initial position, but there is also the "previous" arrow from the last call of animation which is finally overlapped by "new" arrow. So i guess i need to somehow reset/clear the setFillAfter but i can't find a way.
My code goes like this:
//Animation start
float Xaxis=0.835366f;
float Yaxis=0.676692f;
RotateAnimation rotateAnimation1 = new RotateAnimation(0, 180,
Animation.RELATIVE_TO_SELF, Xaxis,Animation.RELATIVE_TO_SELF, Yaxis);
rotateAnimation1.setInterpolator(new LinearInterpolator());
rotateAnimation1.setDuration(2500);
rotateAnimation1.setRepeatCount(0);
image.startAnimation(rotateAnimation1);
rotateAnimation1.setAnimationListener(this);
@Override
public void onAnimationEnd(Animation animation) {
animation.setFillAfter(true);
}
Any ideas would be usefull.. I have tried invalidate, clearAnimation to image, setting fillafter to false, reset on animation but still same.