0

I do a rotate animation on an ImageView at startup of my app.

Then later on an event in the app i want to do a fadeout animation with the same ImageView.

That works, BUT before it does the fadeout animation, it restores the ImageView state to before the rotate animation.

So it jumps back to "unrotated" state and then does the fade out.

Is it possible to keep the animation state the ImageView has after the first rotation and go on from there with the fade out animation?

2 Answers2

0

Just because you animate something doesn't mean you have changed it permanently (see previous discussion). You may want to modify the onAnimationEnd() method to make the effect of your first animation permanent before starting another animation.

Community
  • 1
  • 1
Brian Attwell
  • 9,239
  • 2
  • 31
  • 26
  • ok so onAnimationEnd is where i can make the change permanent, but how? I dont know any other way to rotate an Image than using an animation –  Feb 12 '13 at 17:55
0

Ok i have to use a Matrix rotation instead of an animation i guess:

ImageView circle = (ImageView) findViewById(R.id.imageView1);
Bitmap myImg = BitmapFactory.decodeResource(getResources(), R.drawable.rotated);

Matrix matrix = new Matrix();
matrix.postRotate(45);

Bitmap rot = Bitmap.createBitmap(myImg, 0, 0, myImg.getWidth(), myImg.getHeight(),
        matrix, true);

circle.setImageBitmap(rot);