2011-12-27 19 views
6

Tôi đã tạo một RotateAnimation trong một XML, tải nó với AnimationUtils và đặt nó thành ImageView. Vấn đề tôi phải đối mặt là, khi hình ảnh quay trở lại vị trí ban đầu của nó sau một vòng, thay vì tiến thẳng đến vòng tiếp theo, có một khoảng thời gian chờ nhỏ ở đó, giống như độ trễ.Cách xóa độ trễ khi Xoay hoạt ảnh lặp lại trên Android?

Có giải pháp nào để xóa thời gian chờ này không?

Dưới đây bạn có thể tìm ra xml của hoạt hình:

<?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> 

Cảm ơn trước!

+0

Xem: http://stackoverflow.com/q/1634252/1402846 – Pang

Trả lời

25

Bạn cần đặt linear_interpolator trên bộ này.

<?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> 
+0

Tuyệt vời! Cảm ơn nhiều!! –

Các vấn đề liên quan