zoukankan      html  css  js  c++  java
  • Android 自定义progressBar样式



    1、新建 myprogress_style.xml在drawable中
    <?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>
    <corners android:radius="8.0dip" />
    <gradient android:startColor="#EEEEEE" android:endColor="#EEEEEE"
    android:angle="270.0" />
    </shape>
    </item>
    <item android:id="@android:id/progress">
    <clip>
    <shape>
    <corners android:radius="0.0dip" />
    <gradient android:startColor="@color/red" android:endColor="@color/red"
    android:centerColor="@color/red" android:angle="270.0" />
    </shape>
    </clip>
    </item>
     
    </layer-list>
     
    //android:startColor="@color/red" 为自定义开始颜色
    //<corners android:radius="0.0dip" /> 为两头圆角的弧度,值越大越圆
    //<gradient > 为设置渐变色背景 angle 为角度,必须是45的倍数
     
    2、引用
    <ProgressBar android:id="@+id/pic_ProgressBar"
    style="?android:attr/progressBarStyleHorizontal" 
    android:layout_width="fill_parent" 
    android:visibility="gone" 
    android:layout_height="5dip"
    android:progressDrawable="@drawable/myprogress_style">
  • 相关阅读:
    Angular Material Starter App
    缺少标识符、字符串或数字
    jquery ajax post 传递数组 ,多checkbox 取值
    Circular dependencies cannot exist in RelativeLayout
    第二次作业
    第一次作业
    第一次作业
    软工实践个人总结
    第01组 Beta版本演示
    第01组 Beta冲刺(4/5)
  • 原文地址:https://www.cnblogs.com/xuewater/p/2779523.html
Copyright © 2011-2022 走看看