一、通过动画实现

定义res/anim/loading.xml如下:

<?xml version="1.0" encoding="UTF-8"?>
<animation-list android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:duration="" android:drawable="@drawable/loading_01" />
<item android:duration="" android:drawable="@drawable/loading_02" />
<item android:duration="" android:drawable="@drawable/loading_03" />
<item android:duration="" android:drawable="@drawable/loading_04" />
<item android:duration="" android:drawable="@drawable/loading_05" />
<item android:duration="" android:drawable="@drawable/loading_06" />
<item android:duration="" android:drawable="@drawable/loading_07" />
</animation-list>

二、通过自定义颜色实现

定义res/drawable/progress_small.xml如下:

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees=""
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="" >
<shape
android:innerRadiusRatio=""
android:shape="ring"
android:thicknessRatio=""
android:useLevel="false" >
<gradient
android:centerColor="#FFFFFF"
android:centerY="0.50"
android:endColor="#1E90FF"
android:startColor="#000000"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>

三、使用一张图片进行自定义
定义res/drawable/progress_small.xml如下:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_black_16"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees=""
android:toDegrees="" />

使用方法都一样, 如下:

<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@drawable/progress_small"/>

也可以根据需要通过设置style来设置其大小! 一般只有使用默认的ProgrressBar的时候采用。对于上述三种自定义的方式,建议修改直接修改图片大小,或者shape;

<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
style="?android:attr/progressBarStyleSmall"
android:indeterminateDrawable="@drawable/progress_small"/>

设置成progressBarStyleSmall后,图标变小。 

设置成progressBarStyleLarge后,图标变大

   

参考: http://www.eoeandroid.com/forum.php?mod=viewthread&tid=76872

Android 三种方式实现自定义圆形进度条ProgressBar的更多相关文章

  1. 【Android进度条】三种方式实现自定义圆形进度条ProgressBar

    一.通过动画实现 定义res/anim/loading.xml如下: <?xml version="1.0" encoding="UTF-8"?> ...

  2. Android 三种方式实现自定义圆形页面加载中效果的进度条

    转载:http://www.eoeandroid.com/forum.php?mod=viewthread&tid=76872 一.通过动画实现 定义res/anim/loading.xml如 ...

  3. android圆形进度条ProgressBar颜色设置

    花样android Progressbar http://www.eoeandroid.com/thread-1081-1-1.html http://www.cnblogs.com/xirihanl ...

  4. 【Android 应用开发】 自定义 圆形进度条 组件

    转载著名出处 : http://blog.csdn.net/shulianghan/article/details/40351487 代码下载 : -- CSDN 下载地址 : http://down ...

  5. Android 高手进阶,自己定义圆形进度条

    背景介绍 在Android 开发中,我们常常遇到各种各样绚丽的控件,所以,依靠我们Android本身所带的控件是远远不够的,许多时候须要我们自定义控件,在开发的过程中.我们公司遇到了一种须要自己写的一 ...

  6. Android自定义控件系列之应用篇——圆形进度条

    一.概述 在上一篇博文中,我们给大家介绍了Android自定义控件系列的基础篇.链接:http://www.cnblogs.com/jerehedu/p/4360066.html 这一篇博文中,我们将 ...

  7. android 自定义圆形进度条

    一.通过动画实现 定义res/anim/loading.xml如下: [html]  view plain copy print ?   <?xml version="1.0" ...

  8. Android自定义圆形进度条,完成类似LOFTER效果

    1.http://stackoverflow.com/questions/3760381/rotating-image-animation-list-or-animated-rotate-androi ...

  9. Android 自定义 View 圆形进度条总结

    Android 自定义圆形进度条总结 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 微信公众号:牙锅子 源码:CircleProgress 文中如有纰漏,欢迎大家留言指出. 最近 ...

随机推荐

  1. Linux的一些简单命令操作

    防火墙 查看防火墙状态 systemctl status iptables (或service iptables status) 关闭防火墙 systemctl stop iptables(或serv ...

  2. Redis学习总结和相关资料

    因为别人都在用Redis,所以我不得不用Redis.  听起来感觉我很菜的样子,事实上和菜没有关系.  一是由于别人都用,作为后来者,没有"先发"优势,只能顺着别人的思路来做.当前 ...

  3. map按value查找相应元素

    find_if算法用来在map中查找value符合条件的pair元素,返回指向该符合条件元素的迭代器,如果找到,那么返回最后一个元素的后一个元素end(); 1.首先要定义头文件 #include & ...

  4. Writing buffer overflow exploits - a tutorial for beginners

    Buffer overflows in user input dependent buffers have become one of the biggest security hazards on ...

  5. 有关 Lambda && linq练习 有待整理

    1. 查询Student表中的所有记录的Sname.Ssex和Class列.(select sname,ssex,class from student) Students.Select(s=> ...

  6. 一起talk C栗子吧(第九回:C语言实例--最大公约数)

    各位看官们,大家好.从今天開始,我们讲大型章回体科技小说 :C栗子,也就是C语言实例.闲话休提, 言归正转.让我们一起talk C栗子吧! 看官们.上一回中咱们说的是素数的样例.这一回咱们说的样例是: ...

  7. Docker---(4)Docker 部署spring web项目

    原文:Docker---(4)Docker 部署spring web项目 版权声明:欢迎转载,请标明出处,如有问题,欢迎指正!谢谢!微信:w1186355422 https://blog.csdn.n ...

  8. 调色板原理 & 编程

    调色板原理 & 编程 逻辑调色板结构LOGPALETTE,该结构定义如下: typedef struct tagLOGPALETTE { WORD palVersion; //调色板的板本号, ...

  9. AIX上安装Oracle10G软件

    安装准备 (1)确认系统版本号.内核版本号 # oslevel –r   //查看操作系统版本号 //-08能够安装10g,-09能够安装11g watermark/2/text/aHR0cDovL2 ...

  10. 软件——python,主函数

    1;; 如何在spyder中运行python程序 如下图,   写入一个输出  ' hellow word '的程序 然后点击运行按钮就可以运行了.