You can use the ProgressBar widget:
<ProgressBar android:id="@+id/a_progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
You can customize it with your own image if you want. You just need to create a styles file (res / styles.xml) as follows:
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="AProgressBar"> <item name="android:indeterminateDrawable">@drawable/progress_small</item> <item name="android:minWidth">20dip</item> <item name="android:maxWidth">20dip</item> <item name="android:minHeight">20dip</item> <item name="android:maxHeight">20dip</item> </style> </resources>
@drawable/progress_small refers to an image file named progress_small.png . Then just change your progress bar as follows:
<ProgressBar android:id="@+id/a_progressbar" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/AProgressBar"/>
Cristian
source share