35

I've tried to show an indeterminate activity circle like this one:

enter image description here

Here's the layout code:

<ProgressBar
    android:id="@+id/progress"
    style="@style/GenericProgressIndicator"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_gravity="center_vertical|center_horizontal"
    android:visibility="gone" />

Here's the styling code:

<style name="GenericProgressIndicator" parent="@android:style/Widget.ProgressBar.Large">
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:indeterminate">true</item>
</style>

My circle doesn't look anything like the Holo themed circle that you see in the Gmail App or the Play app. What am I doing wrong? How can I get the nice Holo animated activity circle?

Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382

3 Answers3

57

This really wasn't documented anywhere and I found it through some random article. Adding this styling attribute does the trick:

style="?android:attr/progressBarStyleLarge"

The only reference to this on the developer documentation is here.

Mridang Agarwalla
  • 43,201
  • 71
  • 221
  • 382
  • I wish I could vote several times for this. Actually you can make platform-specific reference for a lot more than only activity circle. Just check a full list list of of [android attributes](http://developer.android.com/reference/android/R.attr.html) – mente Jun 26 '13 at 10:58
20

Your first layout was right but you chose the wrong style. The right one is:

style="@android:style/Widget.Holo.Light.ProgressBar.Large"
vault
  • 3,930
  • 1
  • 35
  • 46
2

What version of Android are you using? If you're not using a version with Holo, you won't be able to display things using the Holo style. A solution to that is to use a library like ActionBarSherlock, which backports the Holo theme to previous Android versions.

CNorris
  • 308
  • 4
  • 13