设置progressbar进度条颜色
来源:互联网 发布:龙卷风流量软件 编辑:程序博客网 时间:2024/05/18 01:05
1、在drawable目录下新建XML文件progressbar_horizontal_red:
- <?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="5dip" />
- <gradient android:startColor="#ff333333"
- android:centerColor="#ff4a4a4a" android:centerY="0.75"
- android:endColor="#ff333333" android:angle="270" />
- </shape>
- </item>
- <item android:id="@android:id/secondaryProgress">
- <clip>
- <shape>
- <corners android:radius="5dip" />
- <gradient android:startColor="#8000AADD"
- android:centerColor="#8000AADD" android:centerY="0.75"
- android:endColor="#8000AADD" android:angle="270" />
- </shape>
- </clip>
- </item>
- <item android:id="@android:id/progress">
- <clip>
- <shape>
- <corners android:radius="5dip" />
- <gradient android:startColor="#fffa6b6b"
- android:centerColor="#ffff0000" android:centerY="0.75"
- android:endColor="#ffe80202" android:angle="270" />
- </shape>
- </clip>
- </item>
- </layer-list>
2、在values目录下新建XML文件styles:
- <?xml version="1.0" encoding="utf-8"?>
- <resources>
- <style name="progressbarStyle_Horizontal_Red" parent="android:Widget.ProgressBar.Horizontal">
- <item name="android:indeterminateOnly">false</item>
- <item name="android:progressDrawable">@drawable/progressbar_horizontal_red</item>
- <item name="android:minHeight">12.0dp</item>
- <item name="android:maxHeight">12.0dp</item>
- </style>
- </resources>
3、布局文件代码:
- <ProgressBar
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- style="@style/progressbarStyle_Horizontal_Red" />
运行起来之后可以发现水平进度条已经变成红色的了~
- ProgressBar 进度条颜色设置
- 设置progressbar进度条颜色
- android圆形进度条ProgressBar颜色设置
- android圆形进度条ProgressBar颜色设置
- ProgressBar 圆形进度条颜色的设置
- ProgressBar水平进度条的颜色设置
- android圆形进度条ProgressBar颜色设置
- android ProgressBar水平进度条的颜色设置
- 给ProgressBar 设置圆形进度条颜色
- ProgressBar水平进度条的颜色设置
- Android进度条ProgressBar颜色的渐变设置
- 修改进度条ProgressBar颜色
- 修改进度条ProgressBar颜色
- 自定义progressbar进度条颜色
- 自定义progressbar进度条颜色
- Android笔记: ProgressBar 圆形进度条颜色的设置
- Android学习札记6:ProgressBar圆形进度条的颜色设置
- Android学习札记7:ProgressBar水平进度条的颜色设置
- BitmapFactory.decodeResource 获取图片宽与高
- css设置ul中li不能实现左对齐(针对非IE浏览器)
- Struts2基于注解的Action配置
- MIPI-技术浅谈
- 使用javac编译java文件和使用javah生成C/C++头文件 遇到找不到类的问题
- 设置progressbar进度条颜色
- 张西雨 你妹的——社会化媒体下个人信息安全的思考
- abstract class 和interface 有什么区别?
- CSS常用代码结构
- 基于ASP.NET MVC 4.0的音乐商店全套项目教程
- Code Review 版本收集
- 老程序员与编程工作
- HttpWatch工具简介及使用技巧
- softirq/tasklet/workqueue的区别