Android Progress Bar slow rotation on pre HoneyCom

2019-09-11 15:26发布

I've been trying to achieve an smooth rotation of a drawer in pre honeycomb devices, but it was impossible for me:

In my layout.xml

<ProgressBar
    style="@style/ProgressBarLarge"
    android:layout_centerInParent="true" />

in styles.xml

<!-- ProgressBar style -->
<style name="ProgressBarLarge" parent="@android:style/Widget.ProgressBar.Large">
    <item name="android:layout_width">@dimen/large_size</item>
    <item name="android:layout_height">@dimen/large_size</item>
    <item name="android:indeterminateDrawable">@drawable/progress_large</item>
</style>

and finally, here is my drawable:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/spinner_green_76"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="infinite"
    android:toDegrees="720" />

It works smoothy on Api 11 + devices, but on pre... it gets barred or slowly...

I'm desperate, I've tried to change the rotate drawer, change drawable resource to the right api version, but I couldn't get anything

1条回答
闹够了就滚
2楼-- · 2019-09-11 15:53

To avoid the processing of every image, you can pre-process them on your computer, and then use a Frame animation:

An animation defined in XML that shows a sequence of images in order (like a film).

查看更多
登录 后发表回答