The simplest Android custom progress bar style

Source: Internet
Author: User

One, custom circular progress bar style

1. Create a new XML file in the Drawable directory of the Android project as follows:

<?xml version= "1.0" encoding= "Utf-8"?><RotateXmlns:android="Http://schemas.android.com/apk/res/android" android:pivotx="50%" android:pivoty="50%" android:fromdegrees="0" android:todegrees= "the" span class= "attribute" >android:interpolator= "@android: Anim/accelerate_decelerate_ Interpolator "
<--progress bar picture--> <bitmap android:antialias= "true" android:filter= "true" span class= "attribute" >android:src= "@drawable/loading360"/></ROTATE>

2. Call
<      android:layout_width= "wrap_content"android:layout_height="Wrap_content"   android:indeterminatedrawable="@drawable/progressbar1"/>


Second, Custom Level progress bar

1.
Create a new XML file in the Drawable directory of the Android project as follows:
<?xml version= "1.0" encoding= "Utf-8"?>
<layer-list xmlns:android= "Http://schemas.android.com/apk/res/android" >
<!--background gradient is a gradient, corners defines rounded corners--
<item android:id= "@android: Id/background" >
<shape>
<corners android:radius= "10DP"/>

<solid android:color= "#ffffff"/>
</shape>
</item>
<!--second progress bar color--
<item android:id= "@android: Id/secondaryprogress" >
<clip>
<shape>
<corners android:radius= "10dip"/>

<gradient
Android:angle= "90.0"
Android:centercolor= "#ac6"
android:centery= "0.45"
Android:endcolor= "#6c2"
Android:startcolor= "#e71a"/>
</shape>
</clip>
</item>
<!--progress Bar--
<item android:id= "@android: Id/progress" >
<clip>
<shape>
<corners android:radius= "10dip"/>

<solid android:color= "#F5e5"/>
</shape>
</clip>
</item>

</layer-list>

2. Call
<progressbar
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
Android:progress= "20"
Android:secondaryprogress= "50"
Style= "@android: Style/widget.holo.progressbar.horizontal"
android:progressdrawable= "@drawable/progress_color"
/>


The simplest Android custom progress bar style

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.