Reprint: http://www.eoeandroid.com/forum.php?mod=viewthread&tid=76872
First, through the animation to achieve
The definition res/anim/loading.xml is as follows:
[Java]View Plaincopy
- <?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>
In the layout file, refer to the following:
[Java]View Plaincopy
- <progressbar android:id="@+id/loading_process_dialog_progressbar"
- Android:layout_width= "wrap_content" android:layout_height="wrap_content "
- Android:indeterminate="false" android:indeterminatedrawable="@anim/loading"/>
Second, through the custom color implementation
The definition res/drawable/dialog_style_xml_color.xml is as follows:
[Java]View Plaincopy
- <?xml version="1.0" encoding="Utf-8"?>
- <rotate xmlns:android="Http://schemas.android.com/apk/res/android"
- android:pivotx= "50%" android:pivoty="50%" android:fromdegrees="0"
- android:todegrees= "> "
- <shape android:shape="Ring" android:innerradiusratio="3"
- android:thicknessratio="8" android:uselevel="false" >
- <gradient android:type="sweep" android:uselevel="false"
- Android:startcolor= "#FFFFFF" android:centercolor= "#FFDC35 "
- android:centery= "0.50" android:endcolor= "#CE0000"/>
- </shape>
- </rotate>
In the layout file, refer to the following:
[Java]View Plaincopy
- <progressbar android:id="@+id/loading_process_dialog_progressbar"
- Android:layout_width= "wrap_content" android:layout_height="wrap_content "
- Android:indeterminate="false" android:indeterminatedrawable="@drawable/dialog_style_xml_color"/>
Third, use a picture to customize
The definition res/drawable/dialog_style_xml_icon.xml is as follows:
[Java]View Plaincopy
- <?xml version="1.0" encoding="Utf-8"?>
- <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
- <item>
- <rotate android:drawable="@drawable/dialog_progress_round"
- android:fromdegrees= "0.0" android:todegrees="360.0" android:pivotx= "50.0% "
- android:pivoty="50.0%"/>
- </item>
- </layer-list>
In the layout file, refer to the following:
[HTML]View Plaincopy
- <ProgressBar android:id="@+id/loading_process_dialog_progressbar"
- android:layout_width= "wrap_content" android:layout_height="wrap_content "
- android:indeterminate="false" android:indeterminatedrawable="@drawable/dialog_style_xml_ Icon " />
Main.xml as follows:
[HTML]View Plaincopy
- <? XML version= "1.0" encoding="Utf-8"?>
- <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation= "Vertical" android:layout_width="fill_parent "
- android:layout_height= "fill_parent" android:gravity="center"
- android:background="#FFF">
- <button android:text= "@string/anim" android:id="@+id/anim "
- android:layout_width="120dip" android:layout_height="wrap_content" />
- <button android:text= "@string/color" android:id="@+id/color "
- android:layout_width="120dip" android:layout_height="wrap_content" />
- <button android:text= "@string/icon" android:id="@+id/icon "
- android:layout_width="120dip" android:layout_height="wrap_content" />
- </linearlayout>
The ProgressBar is then displayed in a dialog box with three buttons to complete.
Animroundprocessdialog.rar
As follows:
Android three ways to implement the progress bar for customizing the effects of a circular page load