I am trying to develop android application. However, I faced with an issue and it is I want to rotate the colorful square background 360 degrees. It is going to be animation effect. Continuously rotate. Is it possible?
I tried view.animate().rotate() but of course , it rotates imageview. I just want to rotate background drawable in imageview.
Activity layout
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/border"
android:contentDescription="@string/todo"
android:cropToPadding="true"
android:padding="10dp"
android:scaleType="centerCrop"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent />
</androidx.constraintlayout.widget.ConstraintLayout>
Background(@drawable/border)
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="270"
android:endColor="@color/colorYellowGreen"
android:type="linear"
android:centerColor="@color/colorBlue"
android:startColor="@color/colorPink" />
<corners android:radius="5dp" />