Android Material Design 进度条 自定义进度条样式

Material Design 进度条

圆形进度条

创建

设置主题为 Theme.AppCompat.Light.NoActionBar
或 @android:style/Theme.Material.Light

修改颜色

添加indeterminateTint属性为颜色
设置indeterminateTintMode属性 为 src_atop

    <ProgressBar
            android:indeterminateTint="#FFFF0000"
            android:indeterminateTintMode="src_atop"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

横向进度条

<android.support.v4.widget.ContentLoadingProgressBar
    android:indeterminate="false"
    android:id="@+id/pb5_progress_hololight"
    style="@android:style/Widget.Holo.Light.ProgressBar.Horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
/>

进度指示模式

    android:indeterminate="false"

未知进度模式

    android:indeterminate="true"

样式

标准,黄色进度条

style="@android:style/Widget.ProgressBar.Horizontal"

Holo进度条,支持4.0

style="@android:style/Widget.Holo.ProgressBar.Horizontal"

Material进度条,5.0以上

style="@android:style/Widget.Material.ProgressBar.Horizontal"

自定义样式

    <ProgressBar   
        android:id="@+id/progressbar"  
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"  
        android:indeterminateDrawable="@drawable/progressbar"  
        />
progressbar.xml
<?xml version="1.0" encoding="utf-8"?>  
<animated-rotate  
        xmlns:android="http://schemas.android.com/apk/res/android"  
         android:pivotX="50%" android:pivotY="50%"      
         android:fromDegrees="0"    
         android:toDegrees="360">  

        <shape   
            android:shape="ring"   
            android:innerRadiusRatio="3"    
            android:thicknessRatio="8"   
            android:useLevel="false">    
            <gradient   
                android:type="sweep"   
                android:useLevel="false"    
                android:startColor="#6BD3FF"           
                android:centerColor="#FF7121"    
                android:centerY="0.50"   
                android:endColor="#FFFF00" />    
        </shape>    

</animated-rotate>  
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值