自定义水平ProgressBar


ProgressDrawable


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

    <!-- background -->
    <item
        android:id="@android:id/background"
        android:drawable="@drawable/progress_patch_white_orange"></item>
    <!-- progress -->
    <item android:id="@android:id/progress">
        <scale
            android:drawable="@drawable/progress_patch_orange"
            android:scaleWidth="100%"></scale>
    </item>
    <!-- second progress -->
    <item android:id="@android:id/secondaryProgress">
        <clip android:drawable="@drawable/progress_patch_orange"></clip>
    </item>

</layer-list>

progress_patch_orange.xml


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <solid android:color="@color/orange" /><!-- 背景填充颜色 -->
    <corners android:radius="20dp" /><!-- 边角圆弧的半径 -->
    <!--<padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" /><!– 四周留出来的空白 –>-->
</shape>


progress_patch_white_orange.xml


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/white" /><!-- 背景填充颜色 -->
    <stroke
        android:width="2dp"
        android:color="@color/orange" /><!-- 描边,边框宽度、颜色 -->
    <corners android:radius="45dp" /><!-- 边角圆弧的半径 -->
    <!--<padding android:left="2dp" android:top="2dp" android:right="2dp" android:bottom="2dp" /><!– 四周留出来的空白 –>-->
</shape>



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值