Home > Back-end >  How to make the image rotate animation on button click in andorid studio?
How to make the image rotate animation on button click in andorid studio?

Time:03-27

In my app, I am trying to make a 90-degree rotation animation on button click and after the click of the button the imageview should not go to its original rotation.

till I am am just able to do the rotation animation but not able to figure out how to keep the image rotated after the animation

 RotateAnimation rotateAnimation=new RotateAnimation(0, 90, RotateAnimation.RELATIVE_TO_SELF,
                   .5f, RotateAnimation.RELATIVE_TO_SELF
                   ,.5f);

           rotateAnimation.setDuration(5000);
           
           imageView.startAnimation(rotateAnimation);

CodePudding user response:

You can do it with animate(). For example: imageView.animate().rotation(90).setDuration(5000).start()

  • Related