I would like to put a progressBar on the action bar but setting
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
on onCreate
method produces a medium size progressBar (48dip x 48dip) I guess. I want to change the size of the progressBar but I cannot find how to do it. Can you help me please?
Styled ANIMATED indeterminate progressbar icon on ActionBar:
1.Define res/values/styles.xml (This example uses Sherlock library to provide actionbar in old Android versions so, if you arent using Sherlock you should use appropiated parents to define your custom styles):
2.Define res/drawable/progress_indeterminate_custom.xml:
3.Above code uses 2 images (ic_progress_logo1 and ic_progress_logo2) as custom progress indeterminated icon. You can use as much images/drawables as you want by adding new item elements. Also, you can apply differents effects/animations. More info here: Animation Resources
4.Apply style you've created using AndroidManifest.xml:
5.Enjoy your animated custom progress indeterminate icon :D
For ActionBarSherlock you can change the indeterminate progress by parenting the Widget.ProgressBar.Small, this should work without Sherlock as well.
I fetched the drawables from the android-15 res folder in the SDK, be sure to grab progress_small_white.xml and associated resource.
To make the ProgressBar on ActionBar smaller, what you want to do is override
Widget.Holo.ProgressBar.Small
like thisand set the size to whatever you want.
You'll need to create your own style to apply to the ActionBar. There's a great tutorial on this on the Android Developers Blog. To style the intermediate progress bar, try using
indeterminateProgressStyle
andWidget.ProgressBar.Small
. Here's a quick example.Paste below code in your
on Create
method and run this below bar in intermediate mode.If you want to show on progress percentage, then comment
progressBar.setIndeterminate(true);
method and uncommentprogressBar.setProgress(65)
method and maintain your progressI have to be compatible with older versions of the Android SDK so I had to keep it simple and used:
Styles.xml
AndroidManifest.xml
for the activity I need to adjust.