Periodically, there is a need to replace the standard circular ProgressBar with any of your own.
Usually, the visual perception of people is more acute, so just give an example of several options ProgressBar

On Habré
some of the preloader generation
resources were discussed, you can use them to create an image that later falls into the ProgressBar.
')
To customize ProgressBar'a need to perform several quite trivial steps:
1. Create Android project
2. Add a file containing loader to the project (for example, res / drawable / loader1.png)
3. Create an animation file (for example, res / drawable / loader1_progress.xml)
- <? xml version = "1.0" encoding = "utf-8" ? >
- < animated-rotate xmlns: android = " schemas.android.com/apk/res/android "
- android: drawable = "@ drawable / loader1"
- android: pivotX = "50%"
- android: pivotY = "50%" />
4. Place ProgressBar in Activiti and say to use our animation resource created in the previous step (for example res / layouts /)
- <? xml version = "1.0" encoding = "utf-8" ? >
- < LinearLayout xmlns: android = " schemas.android.com/apk/res/android "
- android: layout_width = "fill_parent"
- android: layout_height = "fill_parent"
- android: orientation = "vertical" >
- < ProgressBar
- android: indeterminateDrawable = "@ drawable / loader1_progress"
- android: layout_height = "50dp"
- android: layout_width = "50dp" >
- </ ProgressBar >
- </ LinearLayout >
In addition to using ready-made images of loaders, you can also use the android functionality to create a loader manually (for example, /res/drawable/custom_progress.xml)
Consider the example of the figure of the ring. The colors are in the #aarrggbb format, where aa indicates the alpha value (transparency).
- <? xml version = "1.0" encoding = "utf-8" ? >
- < animated-rotate xmlns: android = " schemas.android.com/apk/res/android "
- android: pivotX = "50%"
- android: pivotY = "50%" >
- < shape android: shape = "ring"
- android: innerRadiusRatio = "5"
- android: thicknessRatio = "6"
- android: useLevel = "false" >
- < gradient
- android: type = "sweep"
- android: useLevel = "false"
- android: centerY = "0.10"
- android: startColor = "# 0020ffcc"
- android: centerColor = "# 8820ffcc"
- android: endColor = "# ff20ffcc" />
- < size android: width = "18dip"
- android: height = "18dip" />
- </ shape >
- </ animated-rotate >
If we have several images of the same ProgressBar

then you can use the following method (for example /res/drawable/custom_progress_blue.xml):
- <? xml version = "1.0" encoding = "utf-8" ? >
- < animation-list android: oneshot = "false"
- xmlns: android = " schemas.android.com/apk/res/android " >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_1" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_2" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_3" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_4" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_5" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_6" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_7" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_8" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_9" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_10" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_11" android: scaleGravity = "center" />
- </ item >
- < item android: duration = "100" >
- < scale android: drawable = "@ drawable / blue_12" android: scaleGravity = "center" />
- </ item >
- </ animation-list >
Sample code is available on
github .
If you have any suggestions how else you can realize your plans, feel free to write.