Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 249
Mridang Agarwalla Avatar asked Sep 07 '12 10:09

Mridang Agarwalla


3 Answers

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.

like image 147
Mridang Agarwalla Avatar answered Nov 14 '22 19:11

Mridang Agarwalla


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

style="@android:style/Widget.Holo.Light.ProgressBar.Large"
like image 24
vault Avatar answered Nov 14 '22 18:11

vault


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.

like image 2
CNorris Avatar answered Nov 14 '22 18:11

CNorris