1.indeterminate mode | 没有具体进度的进度条
1.1 定制动画文件
[html] view plaincopy
- <ProgressBar
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:indeterminateDrawable="@drawable/progress_my_style"
- style="?android:attr/progressBarStyle"
注:style="?android:attr/progressBarStyle" 这是默认样式 ,可换改
step2: 在drawable文件夹下建立progress_my_style.xml文件:内容可如下:
[html] view plaincopy
- <animated-rotatexmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/spinner_color"
- android:pivotX="50%"
- android:pivotY="50%"
- />
注意:
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:framesCount与android: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