Rotate animation android

后端 未结 4 2101
轻奢々
轻奢々 2021-02-07 01:25

I\'m trying to do a rotating image animation. I need to rotate an icon around itself just like they do in a progressbar, but what I\'m getting is an image rotat

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-07 01:44

    You could try with the following code, rather than doing it in XML:

    RotateAnimation rotate = new RotateAnimation(0, 360,
            Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f);
    
    rotate.setDuration(4000);
    rotate.setRepeatCount(Animation.INFINITE);
    yourView.setAnimation(rotate);
    

提交回复
热议问题