Mridang Agarwalla
Mridang Agarwalla

Reputation: 45078

How can I display a holo-themed activity circle?

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?

Upvotes: 35

Views: 21007

Answers (3)

vault
vault

Reputation: 4087

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

style="@android:style/Widget.Holo.Light.ProgressBar.Large"

Upvotes: 20

Mridang Agarwalla
Mridang Agarwalla

Reputation: 45078

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.

Upvotes: 57

CNorris
CNorris

Reputation: 308

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.

Upvotes: 2

Related Questions