一、通过动画实现

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

[html] 
view plain
copy
print
?

 

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <animation-list android:oneshot="false"
  3. xmlns:android="http://schemas.android.com/apk/res/android">
  4. <item android:duration="150" android:drawable="@drawable/loading_01" />
  5. <item android:duration="150" android:drawable="@drawable/loading_02" />
  6. <item android:duration="150" android:drawable="@drawable/loading_03" />
  7. <item android:duration="150" android:drawable="@drawable/loading_04" />
  8. <item android:duration="150" android:drawable="@drawable/loading_05" />
  9. <item android:duration="150" android:drawable="@drawable/loading_06" />
  10. <item android:duration="150" android:drawable="@drawable/loading_07" />
  11. </animation-list>

二、通过自定义颜色实现

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

[html] 
view plain
copy
print
?

 

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <rotate xmlns:android="http://schemas.android.com/apk/res/android"
  3. android:fromDegrees="0"
  4. android:pivotX="50%"
  5. android:pivotY="50%"
  6. android:toDegrees="360" >
  7. <shape
  8. android:innerRadiusRatio="3"
  9. android:shape="ring"
  10. android:thicknessRatio="8"
  11. android:useLevel="false" >
  12. <gradient
  13. android:centerColor="#FFFFFF"
  14. android:centerY="0.50"
  15. android:endColor="#1E90FF"
  16. android:startColor="#000000"
  17. android:type="sweep"
  18. android:useLevel="false" />
  19. </shape>
  20. </rotate>

三、使用一张图片进行自定义


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

[html] 
view plain
copy
print
?

 

  1. <rotate xmlns:android="http://schemas.android.com/apk/res/android"
  2. android:drawable="@drawable/spinner_black_16"
  3. android:pivotX="50%"
  4. android:pivotY="50%"
  5. android:fromDegrees="0"
  6. android:toDegrees="360" />

使用方法都一样, 如下:

[html] 
view plain
copy
print
?

 

  1. <ProgressBar
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. android:indeterminateDrawable="@drawable/progress_small"/>

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

[html] 
view plain
copy
print
?

 

  1. <ProgressBar
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. android:layout_centerInParent="true"
  5. style="?android:attr/progressBarStyleSmall"
  6. android:indeterminateDrawable="@drawable/progress_small"/>

设置成progressBarStyleSmall后,图标变小。

设置成progressBarStyleLarge后,图标变大

   

android 自定义圆形进度条的更多相关文章

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

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

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

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

  3. Android 自定义水平进度条的圆角进度

    有时项目中需要实现水平圆角进度,如下两种,其实很简单     下面开始看代码,先从主界面布局开始看起: <?xml version="1.0" encoding=" ...

  4. Android -- 自定义带进度条的按钮

    1. 实现了一个带进度条的按钮,完成后显示提示信息,并设置按钮为不可再次被点击

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

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

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

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

  7. 推荐几个Android自定义的进度条(转载)

    CustomLoading ElasticDownload Circle-Progress-View lzyzsdCircleProgress SquareProgressBar materialis ...

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

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

  9. 自定义VIew——漂亮的圆形进度条

    package com.example.firstapp; import java.text.DecimalFormat; import android.annotation.SuppressLint ...

随机推荐

  1. 剑指offer-面试题17.合并两个排序的链表

    题目:输入两个递增的排序的链表,合并这两个链表并使新链表中的节点仍然是 按照递增排序的.例如链表1链表2合并为链表3. List1:->->-> List2:->->-& ...

  2. Impala 4、Impala JDBC

    • 配置: – impala.driver=org.apache.hive.jdbc.HiveDriver – impala.url=jdbc:hive2://node2:21050/;auth=no ...

  3. Nginx PHP MySql 编译安装

    以CentOS5.6为平台编译安装.确保系统已经安装gcc/gcc-c++编译器! 1.Nginx-1.0.14 2.PHP-5.3.10 3.MySql-5.1.61 安装相关依赖开发库: auto ...

  4. Struts2(五)——核心拦截器

    Struts框架一共为我们提供了35个拦截器,其中默认的拦截器有18个,框架访问action的异常处理,配置信息处理,转发重定向选择,上传等等等等,都是这18个拦截器中设置的,起着非比寻常的作用.而这 ...

  5. MyEclipse 注册码

    MyEclipse 注册码和大家共享一下! 一:MyEclipse_6.0.1GA_E3.3.1_FullStackInstaller注册码 Subscriber:javp Subscription ...

  6. 【特殊的图+DP】【11月校赛】大家一起玩游戏

    大家一起玩游戏 Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submi ...

  7. CentOS 5.7 中文乱码问题解决方案

    一.安装中文支持: # yum install "@Chinese Support" 二.用 yum 安装中文字体 #yum install fonts-chinese.noarc ...

  8. Eclipse 常用快捷键 (动画讲解)(转载)

    http://www.cnblogs.com/TankXiao/p/4018219.html#fix 很详细呀/

  9. 解决获取IP地址时出现“在一个非套…

    今天单位的一台机器在用IPCONFIG/RENEW时遇到了这个问题,上网查了一下,网上的版本在对XP不太好用,网上的版本如下: 1.从注册表中备份以下项:(当然也可以用Erunt备份整个注册表)HKE ...

  10. 查询sybase DB中占用空间最多的前20张表

    按照数据行数查询 name, row_count(db_id(), id) from sysobjects order by row_count(db_id(),id) desc 按照分配的空间查询 ...