First, through the animation to achieve
The definition res/anim/loading.xml is as follows:
<?xml version="1.0"encoding="UTF-8"?> <animation-list android:oneshot="false"xmlns:android="http://schemas.android.com/apk/res/android"> <item android:duration=" Max"android:drawable="@drawable/loading_01"/> <item android:duration=" Max"android:drawable="@drawable/loading_02"/> <item android:duration=" Max"android:drawable="@drawable/loading_03"/> <item android:duration=" Max"android:drawable="@drawable/loading_04"/> <item android:duration=" Max"android:drawable="@drawable/loading_05"/> <item android:duration=" Max"android:drawable="@drawable/loading_06"/> <item android:duration=" Max"android:drawable="@drawable/loading_07"/> </animation-list>
Second, through the custom color implementation
The definition res/drawable/progress_small.xml is as follows:
<?xml version="1.0"encoding="Utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android"android:fromdegrees="0"Android:pivotx="50%"Android:pivoty="50%"android:todegrees=" the"> <Shape Android:innerradiusratio="3"Android:shape="Ring"Android:thicknessratio="8"Android:uselevel="false"> <Gradient Android:centercolor="#FFFFFF"Android:centery="0.50"Android:endcolor="#1E90FF"Android:startcolor="#000000"Android:type="Sweep"Android:uselevel="false"/> </shape> </rotate>
Third, use a picture to customize
The definition res/drawable/progress_small.xml is as follows:
<rotate xmlns:android="http://schemas.android.com/apk/res/android"android:drawable="@drawable/spinner_black_16"Android:pivotx="50%"Android:pivoty="50%"android:fromdegrees="0"android:todegrees=" the"/>
The same method is used, as follows:
<ProgressBar android:layout_width="wrap_content" android: Layout_height="wrap_content" android:indeterminatedrawable= " @drawable/progress_small "/>
You can also set its size by setting the style as needed! Generally only used when using the default Progrressbar. For the above three customization methods, it is recommended to modify the image size directly, or shape;
<ProgressBar android:layout_width="wrap_content"Android:layout_height="wrap_content"android:layout_centerinparent="true"style="? Android:attr/progressbarstylesmall"android:indeterminatedrawable="@drawable/progress_small"/>
When set to Progressbarstylesmall, the icon becomes smaller.
When set to Progressbarstylelarge, the icon becomes larger
Reference: http://www.eoeandroid.com/forum.php?mod=viewthread&tid=76872
Android three ways to implement a custom circular progress bar ProgressBar