How to remove delay when repeating animation on Android?

I built RotateAnimation in XML, loaded it using AnimationUtils and set it to ImageView . The problem I am facing is that when the image returns to its original position after one round, instead of going straight to the next round, there is a short timeout, such as a lag.

Is there a solution to remove this timeout?

Below you can find xml animations:

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <rotate android:interpolator="@android:anim/linear_interpolator" android:duration="1800" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:toDegrees="360"/> </set> 

Thanks in advance!

+6
source share
1 answer

You need to put linear_interpolator in the set.

 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/linear_interpolator"> <rotate android:duration="1800" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:toDegrees="360"/> </set> 
+25
source

Source: https://habr.com/ru/post/904551/


All Articles