Android custom progress bar style and android custom progress bar

Source: Internet
Author: User

Android custom progress bar style and android custom progress bar

Recently I am working on a widget. I need a progressbar. What the product manager and designer give me is to implement a rounded corner progress and custom color, share it with you.


Tested on:Android4.0 +
Procedure:
1. Create your layout file reference progressbar as follows, and reference your custom style in red;

<ProgressBar     android:id="@+id/progressDownload"    style="?android:attr/progressBarStyleHorizontal"     android:layout_width="fill_parent"    android:layout_height="22dp"     android:layout_marginLeft="3dp"    android:layout_marginRight="3dp"     android:max="100"     android:progress="0"    android:progressDrawable="@drawable/progress_horizontal_widgt" />
2. Create the progress_horizontal_widgt.xml name in drawable under your res.

<?xml version="1.0" encoding="utf-8"?><!-- Copyright (C) 2008 The Android Open Source Project Licensed under the     Apache License, Version 2.0 (the "License"); you may not use this file except     in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0     Unless required by applicable law or agreed to in writing, software distributed     under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES     OR CONDITIONS OF ANY KIND, either express or implied. See the License for     the specific language governing permissions and limitations under the License. --><layer-list xmlns:android="http://schemas.android.com/apk/res/android">    <item android:id="@android:id/background">        <shape>            <corners android:radius="11dp" />            <solid android:color="#8842323f" />            <stroke android:width="1px" android:color="#884d363a" />        </shape>    </item>    <item android:id="@android:id/secondaryProgress">        <clip>            <shape>                <corners android:radius="11dp" />                <solid android:color="#5aade3" />                <stroke android:width="1px" android:color="#884d363a" />            </shape>        </clip>    </item>    <item android:id="@android:id/progress">        <clip>            <shape>                <corners android:radius="11dp" />                <solid android:color="#5aade3" />                <stroke android:width="1px" android:color="#884d363a" />            </shape>        </clip>    </item></layer-list>

Effect:(You can adjust the color as needed)


Reprinted, please note: jixiao blog» [original] Android custom progress bar style

Related Article

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.