Android: Changing the Default Indeterminate Progress Size in ActionBarSherlock

Just a quick post on how to change the default size of the Indeterminate Progress animation when using ActionBarSherlock (ABS). This uses the dark halo them for Android 4.0.1 but tested and working from version 2.3.2 to 4.0.1 of the SDK. Here are the before and after shots:

Grab the progress_small_holo.xml and associated images from the Android SDK (15) and move them to your project (from your SDK location: android/platforms/android-15/data/res/drawable). We will be using this to style the progress animation in the ActionBar for ABS Set up your style.xml as follows:

values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Dark" parent="Theme.Sherlock">
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
    </style>

    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
        <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item> 
        <item name="indeterminateProgressStyle">@style/IndeterminateProgress</item> 
    </style>

    <style name="IndeterminateProgress" parent="@android:style/Widget.ProgressBar.Small"> 
       <item name="android:indeterminateDrawable">@drawable/progress_small_holo</item> 
   </style> 
</resource>

values-v14/styles.xml (ICS)

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Dark" parent="Theme.Sherlock">
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
    </style>

    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
        <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item> 
        <item name="indeterminateProgressStyle">@style/IndeterminateProgress</item> 
    </style>

    <style name="IndeterminateProgress" parent="@android:style/Widget.ProgressBar.Small"/> 

</resource>

You could also add some additional sizing if you want to center the progress animation in the actionbar:

<style name="IndeterminateProgress" parent="@android:style/Widget.ProgressBar.Small">
       <item name="android:minWidth">48dp</item> 
</style>

You can see more of the discussion on this thread or from StackOver.

-Mister