Drawable Rotating around its center Android

前端 未结 3 600
猫巷女王i
猫巷女王i 2020-12-13 06:45

I am getting strange results with the following code:

iv = (ImageView) findViewById(R.id.iv);
        iv.setImageResource(R.drawable.spinner_white_76);

             


        
3条回答
  •  清歌不尽
    2020-12-13 07:05

    Feel stupid! Got it to work after spending some time closely reading the documentation:

    Animation a = new RotateAnimation(0.0f, 360.0f,
                    Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
                    0.5f);
            a.setRepeatCount(-1);
            a.setDuration(1000);
    

提交回复
热议问题