我想換一個ProgressBar
的默認的動畫,所以我在主題中添加自定義樣式:的Android定製進度不旋轉
styles.xml
<style name="ProgressTheme" parent="@android:style/Widget.ProgressBar.Large">
<item name="android:indeterminateDrawable">@drawable/spinner_holo_light</item>
</style>
我打電話這裏面我的風格ProgressBar
有以下幾點:
ProgressBar.xml
<ProgressBar
android:id="@+id/loadingProgressBar"
style="@style/ProgressTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
問題在於內部的:
如果我用下面的,一切工作正常與OS 3.0+設備,但進度不旋轉在舊的OS版本:
spinner_holo_light.xml
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_76_inner_holo"
android:fromDegrees="720"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0" />
但是,如果我使用animate-rotate
代替,則動畫適用於每個操作系統版本,但結果是非常滯後的動畫。
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_76_inner_holo"
android:fromDegrees="720"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0" />
您對此有何看法?我在這裏做錯了什麼?
非常感謝,我永遠不會想到這一點。現在它工作得很好。 – astazed