How to rotate a drawable by ObjectAnimator?

后端 未结 2 1523
面向向阳花
面向向阳花 2020-12-17 09:57

Alphaing a drawable work well like this:

if(mAlphaAnimation == null){
        mAlphaAnimation = ObjectAnimator.ofFloat(this, \"alpha\", 0.0f,1.0f).setDurati         


        
2条回答
  •  悲哀的现实
    2020-12-17 10:18

    Try this simple Rotation Animation applied to a image.

     ImageView imageview = (ImageView)findViewById(R.id.myimage);
     RotateAnimation rotate = new RotateAnimation(180, 360, Animation.RELATIVE_TO_SELF,    
     0.5f,  Animation.RELATIVE_TO_SELF, 0.5f);
      rotate.setDuration(500);
     imageview.startAnimation(rotate);
    

    This answer is just for a sake of question, it is correct that Clickable area will be different than View's current position. Please check this question for making clickable area correct. Button is not clickable after TranslateAnimation

提交回复
热议问题