Android自定义进度条样式
2015-01-02 21:24
363 查看
最近在做一个widget,上面需要一个progressbar,产品经理和设计师给出来的东西是要实现一个圆角的progress和自定义的颜色,研究一小下,分享出来给大家哦。
![](http://121.40.200.35/wp-content/uploads/2015/01/20150102111301.jpg)
效果截图:(颜色有出入,可以自行调整)
![](http://121.40.200.35/wp-content/uploads/2015/01/u9VQbgrMmu.png)
转载请注明:破晓博客 » [原创]Android自定义进度条样式
![](http://121.40.200.35/wp-content/uploads/2015/01/20150102111301.jpg)
测试于:Android4.0+
操作步骤:
1.创建你的layout文件引用progressbar如下,标红处引用你自定的样式;
<ProgressBar android:id="@+id/progressDownload" style="?android:attr/progressBarStyleHorizontal" android:layout_width="fill_parent" android:layout_height="22dp" android:layout_marginLeft="3dp" android:layout_marginRight="3dp" android:max="100" android:progress="0" android:progressDrawable="@drawable/progress_horizontal_widgt" />
2.在你的res下的drawable中创建progress_horizontal_widgt.xml 名字你自己可以随便起
<?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape> <corners android:radius="11dp" /> <solid android:color="#8842323f" /> <stroke android:width="1px" android:color="#884d363a" /> </shape> </item> <item android:id="@android:id/secondaryProgress"> <clip> <shape> <corners android:radius="11dp" /> <solid android:color="#5aade3" /> <stroke android:width="1px" android:color="#884d363a" /> </shape> </clip> </item> <item android:id="@android:id/progress"> <clip> <shape> <corners android:radius="11dp" /> <solid android:color="#5aade3" /> <stroke android:width="1px" android:color="#884d363a" /> </shape> </clip> </item> </layer-list>
效果截图:(颜色有出入,可以自行调整)
![](http://121.40.200.35/wp-content/uploads/2015/01/u9VQbgrMmu.png)
转载请注明:破晓博客 » [原创]Android自定义进度条样式
相关文章推荐
- Android自定义进度条样式
- Android Material Design 进度条 自定义进度条样式
- android中自定义进度条样式(ProgressDialog)
- Android中自定义水平进度条样式之黑色虚线
- Android自定义SeekBar样式,遇到的进度条高度问题
- android,自定义进度条样式,圆环,圆弧
- Android 利用shape自定义进度条样式
- Android自定义带水滴的进度条样式(带渐变色效果)
- 安卓android 自定义SeekBar进度条样式
- Android 自定义圆形带刻度渐变色的进度条样式实例代码
- 最简单的android自定义进度条样式
- 自定义Android进度条的不同样式
- android自定义进度条样式
- 替换Android控件默认样式 (例子:自定义进度条)
- 自定义android的tab样式
- Android 自定义Dialog样式
- android自定义按钮控件样式
- android Toast 自定义样式
- android自定义按钮控件样式 (转)
- Android自定义Toast样式