Monday, April 5, 2010

Custom ProgressBar for Android

We will try to make a new progress bar with our own progress animation. It's pretty simple and can be easily set up to run in few minutes. Here we go.

1. MyProgressBar.java
This class extends the ProgressBar class and has two methods that we would need to call to start and stop the animation.

       To start the animation: call startAnimation()
       To stop the animation: call dismiss()

Basically, we run a thread which keeps on switching the images. That's it.

2. myprogressbar.xml

This is the layout that the MyProgressBar would be using. This animation would be using 9 images which are in the drawable folder.




















You can check out the whole project from the SVN. Here is the link.

https://myandroidwidgets.googlecode.com/svn/trunk/Custom_Progress_Bar

4 comments: