"Turn" loading three ways to implement

Source: Internet
Author: User

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
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <animation-list android:oneshot="false"
  3. xmlns:android="Http://schemas.android.com/apk/res/android" >
  4. <item android:duration= "android:drawable="@drawable/loading_01 "/>
  5. <item android:duration= "android:drawable="@drawable/loading_02 "/>
  6. <item android:duration= "android:drawable="@drawable/loading_03 "/>
  7. <item android:duration= "android:drawable="@drawable/loading_04 "/>
  8. <item android:duration= "android:drawable="@drawable/loading_05 "/>
  9. <item android:duration= "android:drawable="@drawable/loading_06 "/>
  10. <item android:duration= "android:drawable="@drawable/loading_07 "/>
  11. </animation-list>


In the layout file, refer to the following:

[Java]View Plaincopy
    1. <progressbar android:id="@+id/loading_process_dialog_progressbar"
    2. Android:layout_width= "wrap_content" android:layout_height="wrap_content "
    3. 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
  1. <?xml version="1.0" encoding="Utf-8"?>
  2. <rotate xmlns:android="Http://schemas.android.com/apk/res/android"
  3. android:pivotx= "50%" android:pivoty="50%" android:fromdegrees="0"
  4. android:todegrees= "> "
  5. <shape android:shape="Ring" android:innerradiusratio="3"
  6. android:thicknessratio="8" android:uselevel="false" >
  7. <gradient android:type="sweep" android:uselevel="false"
  8. Android:startcolor= "#FFFFFF" android:centercolor= "#FFDC35 "
  9. android:centery= "0.50" android:endcolor= "#CE0000"/>
  10. </shape>
  11. </rotate>


In the layout file, refer to the following:

[Java]View Plaincopy
    1. <progressbar android:id="@+id/loading_process_dialog_progressbar"
    2. Android:layout_width= "wrap_content" android:layout_height="wrap_content "
    3. 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
    1. <?xml version="1.0" encoding="Utf-8"?>
    2. <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    3. <item>
    4. <rotate android:drawable="@drawable/dialog_progress_round"
    5. android:fromdegrees= "0.0" android:todegrees="360.0" android:pivotx= "50.0% "
    6. android:pivoty="50.0%"/>
    7. </item>
    8. </layer-list>

In the layout file, refer to the following:

[HTML]View Plaincopy
    1. <ProgressBar android:id="@+id/loading_process_dialog_progressbar"
    2. android:layout_width= "wrap_content" android:layout_height="wrap_content "
    3. android:indeterminate="false" android:indeterminatedrawable="@drawable/dialog_style_xml_ Icon " />


Main.xml as follows:

[HTML]View Plaincopy
  1. <? XML version= "1.0" encoding="Utf-8"?>
  2. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:orientation= "Vertical" android:layout_width="fill_parent "
  4. android:layout_height= "fill_parent" android:gravity="center"
  5. android:background="#FFF">
  6. <button android:text= "@string/anim" android:id="@+id/anim "
  7. android:layout_width="120dip" android:layout_height="wrap_content" />
  8. <button android:text= "@string/color" android:id="@+id/color "
  9. android:layout_width="120dip" android:layout_height="wrap_content" />
  10. <button android:text= "@string/icon" android:id="@+id/icon "
  11. android:layout_width="120dip" android:layout_height="wrap_content" />
  12. </linearlayout>


The ProgressBar is then displayed in a dialog box with three buttons to complete.

Animroundprocessdialog.rar


As follows:

"Turn" loading three ways to implement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.