search

Home  >  Q&A  >  body text

Android progressbar定制

怎样能定制出这种样式的进度条,主要是颜色,边框银色,没有填满的部分是透明的,求指教

PHPzPHPz2769 days ago677

reply all(5)I'll reply

  • 高洛峰

    高洛峰2017-04-17 15:40:33

    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    
        <item android:id="@android:id/secondaryProgress">
            这里定义你要的透明
            <clip >
                <shape >
                    <corners android:radius="6dip" />
                    <solid android:color="#EAEAEA"/>
                </shape>
            </clip>
        </item>
    
        <item android:id="@android:id/progress">
            <clip >
                <shape >
                    <corners android:radius="6dip" />
                    <solid android:color="#03A9F4"/>
                </shape>
    
            </clip>
        </item>
    </layer-list> 

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 15:40:33

    Customize View, draw semicircles on both sides and a straight line in the middle. The progress changes are filled with white.

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 15:40:33

    There are many progress bar controls on github. Open the code to see how to implement it and follow the example

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 15:40:33

    <?xml version="1.0" encoding="utf-8"?>
    <selector xmlns:android="http://schemas.android.com/apk/res/android">
    
        <!--背景-->
        <item android:state_pressed="true">
            <shape>
                <!--色值-->
                <solid android:color="这样颜色值" />
                <!--圆角-->
                <corners android:radius="10dp" />
            </shape>
        </item>
    </selector>

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 15:40:33

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <!-- 背景 -->
        <item android:id="@android:id/background">
            <shape>
                <solid android:color="@color/home_feed_storke_color" />
            </shape>
        </item>
        <!-- 第二条进度条颜色 -->
        <item android:id="@android:id/secondaryProgress">
            <clip>
                <shape>
                    <solid android:color="@color/home_feed_storke_color" />
                </shape>
            </clip>
        </item>
        <!-- 进度条 -->
        <item android:id="@android:id/progress">
            <clip>
                <shape>
                    <solid android:color="@color/main_yellow" />
                </shape>
            </clip>
        </item>
    
    </layer-list>

    reply
    0
  • Cancelreply