Rotate an Imagewith Animation

前端 未结 6 1642
死守一世寂寞
死守一世寂寞 2021-02-01 04:23

\"The

What I Have

I have an arrow image (like the left one). Whe

6条回答
  •  孤独总比滥情好
    2021-02-01 04:46

    First of all, what is you minimum SDK requirement? In case it's at least Android 3.0, you can use the newer animation framework, and animate your Image with something like this:

    imageView.animate().rotation(180).start();
    

    About the flicker: I wouldn't reset the source image of the ImageView after the rotation, I'd just leave in the original and make sure that the rotation animation fills after the animation, leaving the image rotated. The flicker is most likely caused by the View's relayout/redraw upon changing the source image.

    Further visual artifacts (flicker?) may be caused because the original-rotated image and the rotated static image might differ in a few pixels.

提交回复
热议问题