Android Progress Bar slow rotation on pre HoneyComb devices

Deadly 提交于 2019-12-12 02:57:08

问题


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:


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).



来源:https://stackoverflow.com/questions/16633319/android-progress-bar-slow-rotation-on-pre-honeycomb-devices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!