Android circular indeterminate spinner progress bar
drawable/circular_spinner.xml, this xml defines the circular rotation animation on a spinner icon. Change the doDegrees and duration to control the speed of the spinning.
<?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:drawable="@drawable/spinner" android:interpolator="@android:anim/linear_interpolator" android:fromDegrees="0" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:toDegrees="3600" android:duration="1000"/>
activity_main.xml, this is a layout xml file with an indeterminate ProgressBar in the center. It uses the above drawable/circular_spinner.xml as the value of android:indeterminateDrawable
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <ProgressBar android:id="@+id/progressBar" android:layout_width="100dp" android:layout_height="100dp" android:layout_centerInParent="true" android:indeterminateDrawable="@drawable/circular_spinner" > </ProgressBar> </RelativeLayout>
Search within Codexpedia
Custom Search
Search the entire web
Custom Search
Related Posts