2

I want to customize my own progress bar thru image view. I want to change the image view 25 times a second in a loop in order to create a moving image. How can I do the switching of the image?

2 Answers 2

1

You could probably do this with just the normal progressBar - Set up an animationDrawable in your drawables folder like so: (taken from the android docs on animationDrawables).

<!-- Animation frames are wheel0.png -- wheel5.png files inside the
  res/drawable/ folder --> 
<animation-list android:id="selected" android:oneshot="false">
  <item android:drawable="@drawable/wheel0" android:duration="50" />
  <item android:drawable="@drawable/wheel1" android:duration="50" />
  <item android:drawable="@drawable/wheel2" android:duration="50" />
  <item android:drawable="@drawable/wheel3" android:duration="50" />
  <item android:drawable="@drawable/wheel4" android:duration="50" />
  <item android:drawable="@drawable/wheel5" android:duration="50" />
</animation-list>

Then in your code somewhere do:

AnimationDrawable progress = (AnimationDrawable) mProgressBar.getProgressDrawable();
progress.start();

Disclaimer - I haven't tested this, but I don't see why it wouldn't work.

0

link for simple tutorial about custom progress bar custom progress bar

Not the answer you're looking for? Browse other questions tagged or ask your own question.