AndroidEnthusiast
AndroidEnthusiast

Reputation: 6657

How to create a spinning icon in android

I'm trying to implement this common spinning icon I see in many android apps (Gmail below). It is mostly used when refreshing list views. Does anyone know what it is called and how it can be about implemented in a list view?

Spinner icon

Upvotes: 0

Views: 1212

Answers (3)

goodm
goodm

Reputation: 7295

It is ProgressBar http://developer.android.com/reference/android/widget/ProgressBar.html

You just need to setup in your xml file like this:

    <ProgressBar
    android:id="@+id/progressBar1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    android:layout_centerInParent="true"/>

Upvotes: 2

Murali Ganesan
Murali Ganesan

Reputation: 2955

Use the ProgressBar android have various styled ProgressBar. More info click here

Upvotes: 0

Gil Moshayof
Gil Moshayof

Reputation: 16761

It's a progress bar! :)

<ProgressBar
            android:id="@+id/myRotatingProgressBarBar"
            style="@android:style/Widget.ProgressBar.Small.Inverse"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:indeterminate="true"/>

Setting indeterminate="true" makes it a rotating circle rather than a classic progress bar.

There are several different styles you can use. Play around with them to find the one you like :)

Hope this helps!

Upvotes: 4

Related Questions