Marco Dinatsoli
Marco Dinatsoli

Reputation: 10570

android animation stops after each revolution

I want to make a loading image which keep circule.

I tried this:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shareInterpolator="false">

    <rotate 
    android:fromDegrees="0"
    android:toDegrees="360"
    android:duration="1000"
    android:pivotX="50%"
    android:repeatCount="infinite"
    android:pivotY="50%">
</rotate>
</set>

It works good but my problem is the whenever the image goes from 0 to 360, it stops for like 0.001 seconds then rotate again. any help please?

Upvotes: 1

Views: 385

Answers (1)

Neil
Neil

Reputation: 8111

This is because 0 and 360 are at the same location try this:

<?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:fromDegrees="0"
    android:toDegrees="359"
    android:duration="1000"
    android:pivotX="50%"
    android:repeatCount="infinite"
    android:pivotY="50%">
</rotate>
</set>

Upvotes: 2

Related Questions