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" />
运行起来之后可以发现水平进度条已经变成红色的了~
分享到:
相关推荐
本文实例讲述了Android ProgressBar圆形进度条颜色设置方法。分享给大家供大家参考,具体如下: 你是不是还在为设置进度条的颜色而烦恼呢……别着急,且看如下如何解决。 ProgressBar分圆形进度条和水平进度条 我...
使用ProgressBar实现进度条,设置进度条显示风格。以及自定义进度条样式
进度条样式在项目中经常可以见到,下面小编给大家分享Android三种方式实现ProgressBar自定义圆形进度条。 Android进度条有4种风格可以使用。 默认值是progressBarStyle。 设置成progressBarStyleSmall后,图标变小...
Android中使用ProgressBar实现进度条,详细了解请移步:http://blog.csdn.net/zxc514257857/article/details/70557872
Material Design ProgressBar with consistent appearance on Android 4.0 . Why MaterialProgressBar? Consistent appearance on Android 4.0 . Correct tinting across platforms. Able to remove the intrinsic ...
简单的进度条
此为Android ProgressBar 简单进度条的实现及示例下载源码,基本思路是:将模拟任务分成大小为100个的数组,任务完成度--默认为0,状态完成度默认也为0,然后构造一个线程用于显示消息,然后定义dowork()函数,完成...
自定义圆形ProgressBar(进度条),支持各种属性和配置。对应的文章:http://www.cnblogs.com/tianzhijiexian/p/3854346.html
带动画的横向ProgressBar
android ProgressBar进度条等待demo 包括:横线进度条 圆形加载中。。。 自定义progressBar
AndroidProgressBar_Android ProgressBar进度条的几乎全部的用法源码集.rar
从网上整理的c# ProgressBar 光滑进度条的源码,呵呵,大家看看吧~vc#2005的~
progressbar彩色进度条class类,包含progressbar.h头文件和progressbar.cpp源文件
win8 小点进度条,自定义圆形进度条,wpf Progressbar进度条样式更改
Android应用源码之(ProgressBar进度条).zip项目安卓应用源码下载Android应用源码之(ProgressBar进度条).zip项目安卓应用源码下载 1.适合学生毕业设计研究参考 2.适合个人学习研究参考 3.适合公司开发项目技术参考
Android 控件之ProgressBar进度条源码
www.mars-droid.com/Android开发视频教程ProgressBar 进度条 代码 源码 mars老师讲课 android 视频源码 (在此特别感谢mars的无私奉献,此代码为跟随视频边学边做的)
Android 实现简单的水平进度条Demo,编辑器:Android Studio 3.1.2,(ProgressBar的style="?android:attr/progressBarStyleHorizontal")
安卓Android源码——(ProgressBar进度条).rar