* It is required when you set either determinateProgressValue or determinateProgressValuePercentage.
🥢 Methods:
🏃🏾♂️ Lets see it in action
CircularProgressView cpv =findViewById(R.id.cpv);
// You can color the background, the stroke or the border.// Multiple colors for gradient.int[] gradientColors =newint[] {Color.parseColor("#ff9100"),// orangeColor.parseColor("#ff1744") // red};cpv.setBackgroundColor(Color.parseColor("#ffcdd2")); // light redcpv.setBorderColor(Color.parseColor("#ffebee")); // lighter redcpv.setProgressStrokeColor(gradientColors); // a gradient of red and orange// Or pass just a single color for a solid progressStrokeColor./* cpv.setProgressStrokeColor(Color.parseColor("#ff1744")); */
// Choose where the progressStroke should be positioned:cpv.setStrokePlacement(StrokePlacement.OUTSIDE);/* cpv.setStrokePlacement(StrokePlacement.CENTER); *//* cpv.setStrokePlacement(StrokePlacement.INSIDE); */
// Lets suppose you are downloading a file, and you want to show a progress:cpv.setProgressType(ProgressType.DETERMINATE)int totalBytes =349022; // the maximum value of the progresscpv.setRange(totalBytes);// Update the progress using:cpv.setProgress(10.0f,true) // 10% of the maximum value of the progress.// Or if you want to update the progress using a value out of total.int downloadedBytes =1230; // downloaded 1230 bytes out of the total of 349022;int p =CircularProgressView.calcProgressValuePercentageOf(downloadedBytes, totalBytes)cpv.setProgress(p,true);
Last updated
XML Attributes
Description
Data Type
Possible Values
Default Value
Is Required?
progressType
Determinate indicators display how long a process will take. They should be used when the process completion rate can be detected.
Indeterminate indicators express an unspecified amount of wait time. They should be used when progress isn’t detectable, or if it’s not necessary to indicate how long an activity will take.
enum
determinate
indeterminate
indeterminate
NO
progressStrokeColor
the color of the progress stroke indicator
color
n/a
#000000
(black)
NO
backgroundColor
the color between the stroke indicator
color
n/a
#FF000000
(transparent)
NO
borderColor
a light color used to highlight the stroke indicator path
color
n/a
#FF000000
(transparent)
NO
determinateProgressValue
sets the current progress value based on the provided maxDeterminateProgressValue*
float
n/a
n/a
NO
determinateProgressValuePercentage
sets the current progress value by percentage based on the provided maxDeterminateProgressValue*
float
n/a
n/a
NO
maxDeterminateProgressValue*
the maximum value of the progress indicator. Corresponds to 100%.
float
n/a
n/a
YES*
progressStrokePlacement
sets where the stroke indicator should be placed.
enum
outside
inside
center
inside
NO
Return type
Method & Description
boolean
isIndeterminate()
Returns whether the progress type is ProgressType.INDETERMINATE
void
setBackgroundColor(int colorInt)
Changes the current backgroundColor to the specified one.
void
setBorderColor(int colorInt)
Changes the current borderColor to the specified one.