<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" />
I have an imageview in the middle of an activity, how would I make it so it rotates 360 degrees endlessly?
Displays image resources, for example Bitmap or Drawable resources. ImageView is also commonly used to apply tints to an image and handle image scaling. To learn more about Drawables, see: Drawable Resources.
Try to use 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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With