Reputation: 20699
Looking at this question, I created the following files:
res/drawable/spinner.xml
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loading"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:fromDegrees="0"
android:toDegrees="718"
android:fillAfter="false"
android:startOffset="0"
android:interpolator="@android:anim/linear_interpolator"
/>
and res/layout/layout.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/splashSpinnerImageView"
android:layout_width="260dp"
android:layout_height="260dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@drawable/spinner"
/>
</RelativeLayout>
Still the spinner is rotating with visible hickups and not really smoothly. I tested it with Sony Xperia S and Z2, and it has the same behaviour.
What can I do to increase smothiness of my ProgressBar? Should I convert ProgressBar to ImageView and/or start the animation programmatically?
TIA
UPDATE:
I tried using the default android's progress_large.xml
in my project, but the most 'interesting' attributes
android:framesCount="12"
android:frameDuration="100"
couldn't be found as they are defined private
Upvotes: 1
Views: 1562
Reputation: 20699
I found a problem somewhere else. For my top-most RelativeLayout I used a PNG 1080x1920 as a background. It weighed 480 kB and with this one even the default `ProgressBar' - thanks to #pskink 's hint - was spinning with hickups.
Then I tried to make it smaller with 720x1280 pixels resolution @ 360 kB, and - magic! - the spinner started to rotate smoothly!
Android seems to have problems with hi-res pics...
Upvotes: 1