First, through the animation to achieve
The definition res/anim/loading.xml is as follows:
[HTML]View Plaincopyprint?
- <? XML version= "1.0" encoding="UTF-8"?>
- <animation-list android:oneshot="false"
- xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:duration= "android:drawable=" @drawable/loading_01 " />
- <item android:duration= "android:drawable=" @drawable/loading_02 " />
- <item android:duration= "android:drawable=" @drawable/loading_03 " />
- <item android:duration= "android:drawable=" @drawable/loading_04 " />
- <item android:duration= "android:drawable=" @drawable/loading_05 " />
- <item android:duration= "android:drawable=" @drawable/loading_06 " />
- <item android:duration= "android:drawable=" @drawable/loading_07 " />
- </animation-list>
Second, through the custom color implementation
The definition res/drawable/progress_small.xml is as follows:
[HTML]View Plaincopyprint?
- <? 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= " > "
- <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:
[HTML]View Plaincopyprint?
- <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 same method is used, as follows:
[HTML]View Plaincopyprint?
- <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;
[HTML]View Plaincopyprint?
- <progressbar
- android:layout_width=" wrap_content "&NBSP;&NBSP;
- android:layout_height= "wrap_content" &NBSP;&NBSP;
- android:layout_centerinparent=
- style= "Android: Attr/progressbarstylesmall "&NBSP;&NBSP;
- "@drawable/progress_small" />
When set to Progressbarstylesmall, the icon becomes smaller.
When set to Progressbarstylelarge, the icon becomes larger
Original: http://blog.csdn.net/feng88724/article/details/7409032