Android custom ring loadingview effect
A circular progress bar is used in recent projects. GitHub has a similar dashedcircularprogress control, but the progress he draws is separated by setting the dotted line effect of the brush: progresspaint. Setpatheffect (New dashpatheffect (new float [] {dashwith, dashspace}, dashspace)); If there is a ring in the inner layer, there is a slight deviation between the inner layer and the outer layer during dynamic setting. Therefore, I changed one on the original basis to achieve the effect I want (you can choose to add animation or not when setting the progress):
Control implementation:
This control inherits relativelayout and does two things during OnDraw:
1. First draw the black circle at the bottom; 2. Draw the corresponding proportion of the outer green ring according to the progress value at that time
Provide an interface to call back the current progress value:
Core drawing class:
Internalcirclepainterimpo2, draw the black ring of the inner layer:
Progresspainterinp2, draw the black ring of the inner layer:
Customizable properties:
Call:
main_ activity.xml:
MainActivity:
GitHub address: https://github.com/506954774/AndroidCircularLoadingView
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.