如何使imageview不断旋转?

Adi*_*dey 5 android imageview spin

<ImageView
      android:id="@+id/imageView1"
      android:layout_width="300dp"
      android:layout_height="300dp"
      android:src="@drawable/zaid1"
      android:layout_centerVertical="true"
      android:layout_centerHorizontal="true" />
Run Code Online (Sandbox Code Playgroud)

我在活动中间有一个imageview,我怎么做它让它无休止地旋转360度?

小智 22

尝试使用RotateAnimation:

RotateAnimation rotateAnimation = new RotateAnimation(0, 360f,
    Animation.RELATIVE_TO_SELF, 0.5f,
    Animation.RELATIVE_TO_SELF, 0.5f);

rotateAnimation.setInterpolator(new LinearInterpolator());
rotateAnimation.setDuration(500);
rotateAnimation.setRepeatCount(Animation.INFINITE);

findViewById(R.id.imageView1).startAnimation(rotateAnimation);
Run Code Online (Sandbox Code Playgroud)