自定义水平进度条(颜色)
来源:互联网 发布:网络游戏音乐大全 编辑:程序博客网 时间:2024/06/04 04:16
一、1.在资源文件styles里面创建一个style:
<style name="ProgressBar_red_gray" parent="@android:style/Widget.ProgressBar.Horizontal"> <item name="android:progressDrawable">@drawable/progress_horizontal_red_gray</item> </style>progress_horizontal_red_gray为一个layer-list资源,内容如下:
<?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="5dip" /> <gradient android:angle="270" android:centerColor="#ffcccccc" android:centerY="0.75" android:endColor="#ffcccccc" android:startColor="#ffcccccc" /> </shape> </item> <item android:id="@android:id/secondaryProgress"> <clip> <shape> <corners android:radius="5dip" /> <gradient android:angle="270" android:centerColor="#80ffb600" android:centerY="0.75" android:endColor="#a0ffcb00" android:startColor="#80ffd300" /> </shape> </clip> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="5dip" /> <gradient android:angle="270" android:centerColor="#ffDE2632" android:centerY="0.75" android:endColor="#ffDE2632" android:startColor="#ffDE2632" /> </shape> </clip> </item></layer-list>shape可以自定义,<clip>标签不能去掉
2.在布局文件设置ProgressBar的style为ProgressBar_red_gray即可,如下:
<ProgressBar android:id="@+id/pgb_support_percent" style="@style/progress_horizontal_red_gray" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="5" />
二、首先如上创建drawable资源 progress_horizontal_red_gray,然后在在布局文件设置ProgressBar的android:progressDrawable属性为progress_horizontal_red_gray,如下:
<ProgressBar android:id="@+id/pgb_support_percent" style="@android:style/Widget.ProgressBar.Horizontal" android:progressDrawable="@drawable/progress_horizontal_red_gray" android:layout_width="match_parent" android:layout_height="wrap_content" android:max="100" android:progress="5" />
0 0
- 自定义水平进度条(颜色)
- 自定义进度条(水平,圆形)
- 自定义进度条(水平进度条和圆形进度条)
- 自定义水平进度条
- android 自定义水平进度条
- 自定义水平进度条
- Android自定义水平进度条
- 自定义水平进度条
- 水平进度条,添加颜色变化
- 简单的自定义水平进度条
- 自定义水平进度条Horizontal ProgressBar
- Android自定义水平进度条控件
- Android自定义水平渐变进度条
- android 自定义进度条颜色
- Android自定义进度条颜色
- Android自定义进度条颜色
- android 自定义进度条颜色
- android 自定义进度条颜色
- java函数参数传参
- 支付宝通知页面notify_url、返回页面return_url
- 给定一个入栈顺序,输出所有的出栈顺序
- OpenStack入门 之 初步了解
- 直方图均衡化
- 自定义水平进度条(颜色)
- Educational Codeforces Round 10 B. z-sort
- JavaSe基础(6)-- 方法
- 利用 Composer 一步一步构建自己的 PHP 框架(三)——设计 MVC
- 使用eclipse或者myeclipse时,鼠标变成黑色十字架解决办法
- HTML压缩(JSP的GZIP实现)
- 保存今天的代码
- nginx配置python的cgi
- 如何查看iOS已上架app崩溃分布、定位crash发生的行