Android ProgressBar style, androidprogressbar

Source: Internet
Author: User

Android ProgressBar style, androidprogressbar


The Android system has been changed by major manufacturers, and the effects of various system components on different mobile phones are completely different. To maintain a unified interface style during development, you must modify the style of all system components. Now you need to modify the defaultProgressBarAs far as the Android system is concerned, different versions of components have different styles.

ProgressBar style in the system


Findandroid-sdkDirectoryplatforms\android-15\data\res\valuesInstyles.xmlAnd then find the ProgressBar, you can find

<style name="Widget.ProgressBar">        <item name="android:indeterminateOnly">true</item>        <item name="android:indeterminateDrawable">@android:drawable/progress_medium_white</item>        <item name="android:indeterminateBehavior">repeat</item>        <item name="android:indeterminateDuration">3500</item>        <item name="android:minWidth">48dip</item>        <item name="android:maxWidth">48dip</item>        <item name="android:minHeight">48dip</item>        <item name="android:maxHeight">48dip</item>    </style>

android:indeterminateDrawableIs@android:drawable/progress_medium_white, Find progress_medium_white.xml in the drawable directory, and open

<?xml version="1.0" encoding="utf-8"?><animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"    android:drawable="@drawable/spinner_white_48"    android:pivotX="50%"    android:pivotY="50%"    android:framesCount="12"    android:frameDuration="100" />

Using a simple spinner_white_48.pngRotating Animation

Custom android:indeterminateDrawableValue rotation Animation
<?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="360">    <bitmap        android:src="@mipmap/icon_timeline_stop_blue"        android:antialias="true"        android:filter="true"></bitmap></rotate>

Then

    <ProgressBar        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:indeterminateDrawable="@drawable/loading_anim"        android:id="@+id/progressBar" />

You can create a simple ssbar for rotating styles.

Frame Animation

Another style isFrame Animation, There is something to note here

Two images for Frame Animation

<?xml version="1.0" encoding="utf-8"?><animation-list xmlns:android="http://schemas.android.com/apk/res/android"    android:oneshot="false">    <item android:duration="100">        <clip            android:clipOrientation="horizontal"            android:drawable="@mipmap/kaoyan_tip_f1"            android:gravity="left" />    </item><item android:duration="100">    <clip        android:clipOrientation="horizontal"        android:drawable="@mipmap/kaoyan_tip_f2"        android:gravity="left" /></item></animation-list>

Note that you must useclipNode to specifyandroid:clipOrientationAndandroid:gravity="left"Otherwise, the screen may be incomplete.

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.