Android自定义进度条颜色
这个没法了只能看源码了,还好下载了源码, sources\base\core\res\res\ 下应有尽有,修改进度条颜色只能找progress ,因为是改变样式,首先找styles.xml
1
2
3
4
5
6
7
8
9
10
|
< style name = "Widget.ProgressBar" > < item name = "android:indeterminateOnly" >true</ item > < item name = "android:indeterminateDrawable" >@android:drawable/progress_medium_white</ item > < item name = "android:indeterminateBehavior" >repeat</ item > < item name = "android:indeterminateDuration" >3500</ item > < item name = "android:minWidth" >48dip</ item > < item name = "android:maxWidth" >48dip</ item > < item name = "android:minHeight" >48dip</ item > < item name = "android:maxHeight" >48dip</ item > </ style > |
进度条颜色,所以找到:
1
2
3
4
5
6
7
|
< style name = "Widget.ProgressBar.Horizontal" > < item name = "android:indeterminateOnly" >false</ item > < item name = "android:progressDrawable" >@android:drawable/progress_horizontal</ item > < item name = "android:indeterminateDrawable" >@android:drawable/progress_indeterminate_horizontal</ item > < item name = "android:minHeight" >20dip</ item > < item name = "android:maxHeight" >20dip</ item > </ style > |
Android:progressDrawable"> 所以我们可以找到"drawable下的 progress_horizontal 文件,改变他就可以改变进度条颜色。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<? 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 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. --> < item android:id = "@android:id/background" > < shape > < corners android:radius = "5dip" /> < gradient android:angle = "270" android:centerColor = "#ff5a5d5a" android:centerY = "0.75" android:endColor = "#ff747674" android:startColor = "#ff9d9e9d" /> </ 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 = "#ffffb600" android:centerY = "0.75" android:endColor = "#ffffcb00" android:startColor = "#ffffd300" /> </ shape > </ clip > </ item > </ layer-list > |
1
2
3
|
android:startColor="#80ffd300" android:centerColor="#80ffb600" android:endColor="#ff747674" |
在我们的项目下新建一个 style.xml 文件
1
2
3
4
5
6
7
|
< style name = "ProgressBar_Mini" parent = "@android:style/Widget.ProgressBar.Horizontal" > < item name = "android:maxHeight" >50dip</ item > < item name = "android:minHeight" >8dip</ item > < item name = "android:indeterminateOnly" >false</ item > < item name = "android:indeterminateDrawable" >@android:drawable/progress_indeterminate_horizontal</ item > < item name = "android:progressDrawable" >@drawable/progressbar_mini</ item > </ style > |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
< item android:id = "@android:id/background" > < shape > < corners android:radius = "5dip" /> < gradient android:angle = "270" android:centerY = "0.75" android:endColor = "#F5F5F5" android:startColor = "#BEBEBE" /> </ shape > </ item > < item android:id = "@android:id/secondaryProgress" > < clip > < shape > < corners android:radius = "0dip" /> < gradient android:angle = "270" android:centerY = "0.75" android:endColor = "#165CBC" android:startColor = "#85B0E9" /> </ shape > </ clip > </ item > < item android:id = "@android:id/progress" > < clip > < shape > < corners android:radius = "5dip" /> < gradient android:angle = "270" android:centerY = "0.75" android:endColor = "#165CBC" android:startColor = "#85B0E9" /> </ shape > </ clip > </ item > </ layer-list > |
1
2
3
4
5
6
|
< ProgressBar android:id = "@+id/progress" style = "@style/ProgressBar_Mini" android:layout_width = "fill_parent" android:layout_height = "wrap_content" android:progress = "50" /> |
http://blog.csdn.net/roserose0002/article/details/7988779
Android自定义进度条颜色的更多相关文章
- android 自定义进度条颜色
android 自定义进度条颜色 先看图 基于产品经理各种自定义需求,经过查阅了解,下面是自己对Android自定义进度条的学习过程! 这个没法了只能看源码了,还好下载了源码, sources\b ...
- 最简单的android自定义进度条样式
一.自定义圆形进度条样式 1.在安卓项目drawable目录下新建一个xml文件如下:<?xml version="1.0" encoding="utf-8&quo ...
- Android自定义进度条
Android原生控件只有横向进度条一种,而且没法变换样式,比如原生rom的样子很丑是吧,当伟大的产品设计要求更换前背景,甚至纵向,甚至圆弧状的,咋办,比如ok,我们开始吧: 一)变换前背景 先来看看 ...
- Android自定义进度条-带文本(文字进度)的水平进度条(ProgressBar)
水平进度条,显示进度的文本随着进度而移动. 效果如下,截的静态图. 代码如下 TextProgressBar.java public class TextProgressBar extends Pro ...
- android圆形进度条ProgressBar颜色设置
花样android Progressbar http://www.eoeandroid.com/thread-1081-1-1.html http://www.cnblogs.com/xirihanl ...
- BitBlt()函数实现带数字百分比进度条控件、静态文本(STATIC)控件实现的位图进度条、自定义进度条控件实现七彩虹颜色带数字百分比
Windows API BitBlt()函数实现带数字百分比进度条控件. 有两个例子:一用定时器实现,二用多线程实现. 带有详细注解. 此例是本人原创,绝对是网上稀缺资源(本源码用Windows AP ...
- Android 设置进度条背景
Android 设置进度条背景 直接上代码 <ProgressBar android:id="@+id/progressBar" android:layout_width=& ...
- android113 自定义进度条
MainActivity: package com.itheima.monitor; import android.os.Bundle; import android.app.Activity; im ...
- 自定义进度条PictureProgressBar——从开发到开源发布全过程
自定义进度条PictureProgressBar——从开发到开源发布全过程 出处: 炎之铠邮箱:yanzhikai_yjk@qq.com 本文原创,转载请注明本出处! 本项目JCenter地址:htt ...
随机推荐
- 【使用 DOM】使用 Window 对象
1. 获取 Window 对象 可以用两种方式获得Window对象.正规的HTML5方式是在Document对象上使用defaultView属性.另一种是使用所有浏览器都支持的全局变量window . ...
- 使用WebMatrix发布网站
使用WebMatrix发布网站 WebMatrix 简介: Microsoft WebMatrix 是微软最新的 Web 开发工具,它包含了构建网站所需要的一切元素.您可以从开源 Web 项目或者内置 ...
- 如何查询拥有执行某个Tcode权限所有人员
方法很简单,如下 一:Tcode:S_BCE_68001400二:输入你想查询的Tcode,例如:SE38 打开如下图所示,然后执行即可 三:AUTH(关于权限的控制),打开如下图所示.上图“ ...
- IOS 杂笔-19(属性与变量的优缺点)
IOS 杂笔-19(属性与变量的优缺点) 在前面的文章中我介绍了属性与变量的区别.这篇博客我将会简单介绍一下属性与变量的优缺点. 变量 优点: 访问速度快 缺点: 使用不灵活 属性 缺点: 耗时 优点 ...
- Swift开发第四篇——柯里化
本篇分为两部分: 一.柯里化的基本使用 二.柯里化的使用场景 一.柯里化的基本使用 柯里化(Currying):也就是把接受多个参数的方法变换成接受第一个参数的方法,并且返回接受余下的参数并且返回结果 ...
- iOS内存管理(二)之深拷贝和浅拷贝
对象拷贝(复制对象) 1.复制对象顾名思义,复制一个对象作为副本,它会开辟一块新的一块内存(堆内存)来存储副本对象,就像复制文件一样.即源对象和副本对象是两块不同的内存区域. 2.NSObject ...
- object-c中的类目,延展,协议
协议 协议只有方法的声明(类似于其他编程语言的接口) 协议相当于大家都所遵循的 关键字 @protocol 协议名 <所遵循的协议> 默认NSObject @end @pr ...
- 超酷的测速网站Ookla SPEEDTEST
测试网速的工具.网站估计不少,在百度一搜都能搜出一大堆,下面介绍一个国外测试网速的网站,用户体验相当棒,感觉酷毙了,那些其它测试网速的网站跟这个比起来,简直弱毙了.这个网速测试网站就是:http:// ...
- JDK6与JDK7中String类subString()方法的区别
1.subString()方法的作用 subString(int beginIndex, int endIndex)方法的返回的是以beginIndex开始到 endIndex-1结束的某个调用字符串 ...
- oracle表相关
堆表 数据以堆的形式管理,增加数据时会使用段中找到的第一个能放下数据的自由空间,我们见到的绝大部分的表都是堆表.堆表是数据库的默认表类型. 最简单的情况是 create table test (c1 ...