android ProgressBar定制模式,自定义模式动画文件

1.indeterminate mode | 没有具体进度的进度条

1.1 定制动画文件
[html] view plaincopy
  1. <ProgressBar
  2. android:layout_width="wrap_content"
  3. android:layout_height="wrap_content"
  4. android:indeterminateDrawable="@drawable/progress_my_style"
  5. style="?android:attr/progressBarStyle"

 

 



注:style="?android:attr/progressBarStyle" 这是默认样式 ,可换改

step2: 在drawable文件夹下建立progress_my_style.xml文件:内容可如下:

[html] view plaincopy

  1. <animated-rotatexmlns:android="http://schemas.android.com/apk/res/android"
  2. android:drawable="@drawable/spinner_color"
  3. android:pivotX="50%"
  4. android:pivotY="50%"
  5. />




注意:
1. android:drawable="@drawable/spinner_color" 这里,你需要在drawable下建立spinner_color.png图片(自己画成你所想到的效果(渐变))

2. progress_my_style.xml文件内容参考至D:\andrirod\android-sdk-windows\platforms\android-7\data\res\drawable\progress_medium_white.xml文件内容,
android:framesCountandroid:frameDuratiion是frameworks内部的属性,无法直接使用,所以省略)
以上是在XML中直接定义,下面是我在代码里直接定义的:
http://www.52liezheng.com/info/337083.html
http://www.52liezheng.com/info/337085.html
http://www.52liezheng.com/info/337087.html
http://www.52liezheng.com/info/337091.html
http://www.52liezheng.com/info/337089.html
http://www.52liezheng.com/info/340881.html
http://www.52liezheng.com/info/340882.html
http://www.52liezheng.com/info/340883.html
http://www.52liezheng.com/info/340885.html
http://www.52liezheng.com/info/340886.html
http://www.52liezheng.com/info/340887.html
http://www.52liezheng.com/info/340888.html

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。