如何改变进度条的颜色? [英] how to change ProgressBar color?

查看:147
本文介绍了如何改变进度条的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要改变水平 进度颜色

我已经试过这种

<一个href="http://stackoverflow.com/questions/2729180/how-to-change-the-color-of-an-indefinite-progressbar">How改变一个不确定的进度条的颜色?

它不工作还在进展中的蓝色执行

its not working still progress run in blue color

这是我的code

<ProgressBar
                 android:id="@+id/mini_progress"
                 android:layout_marginLeft="10dip"
                 android:layout_marginRight="10dip"
                 style="?android:attr/progressBarStyleHorizontal"
                 android:layout_width="match_parent"
                 android:layout_height="20dip"
                 android:layout_gravity="center_horizontal"
                 android:indeterminate="false"
                 android:indeterminateBehavior="repeat"
                 android:indeterminateOnly="true"
                 android:visibility="gone"/>

我怎么可以变成粉红的颜色?

how i can change the color to Pink ?

推荐答案

试试这个code -

Try this code -

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

    <item android:id="@android:id/secondaryProgress">
        <clip>
            <shape>
                <corners android:radius="5dip" />

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

        <color android:color="#f58233" />
    </item>
    <item android:id="@android:id/progress">
        <clip>
            <shape>
                <corners android:radius="5dip" />

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

        <color android:color="#f58233" />
    </item>

</layer-list>

进度条 -

Progress Bar -

<ProgressBar
            android:id="@+id/progressBar1"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="200dp"
            android:layout_height="3dip"
            android:progressDrawable="@drawable/progress_bar" />

根据您的需要更改颜色codeS

Change color codes according to your need

这篇关于如何改变进度条的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆