# CircularProgressIndicator

[View Source](https://github.com/material-components/material-components-android/blob/1.14.0/lib/java/com/google/android/material/progressindicator/CircularProgressIndicator.java)

*** ** * ** ***


```
public class CircularProgressIndicator extends BaseProgressIndicator
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [com.google.android.material.progressindicator.BaseProgressIndicator](https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator) ||
|   | ↳ | [com.google.android.material.progressindicator.CircularProgressIndicator](https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator) |

*** ** * ** ***

This class implements the circular type progress indicators.

With the default style `Widget.MaterialComponents.CircularProgressIndicator`, 4dp indicator/track thickness is used without animation for visibility change. Without customization, primaryColor will be used as the indicator color; the track is transparent. The following attributes can be used to customize the component's appearance:

- `trackThickness`: the thickness of the indicator and track.
- `indicatorColor`: the color(s) of the indicator.
- `trackColor`: the color of the track.
- `trackCornerRadius`: the radius of the rounded corner of the indicator and track.
- `indicatorSize`: the outer diameter of the spinner.
- `indicatorInset`: the inset from component's bound to the spinner's outer edge.
- `indicatorDirectionCircular`: the rotation direction of the spinner or indicator.

For more information, see the [component developer guidance](https://github.com/material-components/material-components-android/blob/master/docs/components/ProgressIndicator.md) and [design guidelines](https://material.io/components/progress-indicators/overview).

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#DEF_STYLE_RES()` |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#INDETERMINATE_ANIMATION_TYPE_ADVANCE() = 0` Used in the indeterminate animation type setter for advance animation, which animates an active segment to iteratively grow by modifying the end position and shrink by modifying the start position. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#INDETERMINATE_ANIMATION_TYPE_RETREAT() = 1` Used in the indeterminate animation type setter for retreat animation, which animates an active segment to iteratively grow and shrink by modifying the end position. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#INDICATOR_DIRECTION_CLOCKWISE() = 0` |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#INDICATOR_DIRECTION_COUNTERCLOCKWISE() = 1` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#CircularProgressIndicator(Context)(Context context)` |
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#CircularProgressIndicator(Context,AttributeSet)(Context context, AttributeSet attrs)` |
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#CircularProgressIndicator(Context,AttributeSet,int)( Context context, AttributeSet attrs, int defStyleAttr )` |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndeterminateAnimationType()()` Returns the type of indeterminate animation of this progress indicator. |
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndicatorDirection()()` Returns the indicator animating direction used in this progress indicator. |
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndicatorInset()()` Returns the inset of this progress indicator. |
| `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndicatorSize()()` Returns the size (outer diameter) of this progress indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndeterminateAnimationType(int)(int indeterminateAnimationType)` Sets the type of indeterminate animation. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndicatorDirection(int)(int indicatorDirection)` Sets the indicator animating direction used in this progress indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndicatorInset(int)(int indicatorInset)` Sets the inset of this progress indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndicatorSize(int)(int indicatorSize)` Sets the size (outer diameter) of this circular progress indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setTrackThickness(int)(int trackThickness)` Sets the track thickness of this progress indicator. |

| ### Inherited Constants |
|---|
| From [com.google.android.material.progressindicator.BaseProgressIndicator](https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator) |---|---| | `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#HIDE_ESCAPE() = 3` | | `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#HIDE_INWARD() = 2` | | `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#HIDE_NONE() = 0` | | `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#HIDE_OUTWARD() = 1` | | `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#SHOW_INWARD() = 2` | | `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#SHOW_NONE() = 0` | | `static final int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#SHOW_OUTWARD() = 1` | |

| ### Inherited methods |
|---|
| From [com.google.android.material.progressindicator.BaseProgressIndicator](https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator) |---|---| | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#applyNewVisibility(boolean)(boolean animate)` If it changes to visible, the start animation will be started if `showAnimationBehavior` indicates any. | | `Drawable` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getCurrentDrawable()()` Returns the corresponding drawable based on current indeterminate state. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getHideAnimationBehavior()()` Returns the hide animation behavior used in this progress indicator. | | `https://developer.android.com/reference/com/google/android/material/progressindicator/IndeterminateDrawable<S>` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getIndeterminateDrawable()()` | | `int[]` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getIndicatorColor()()` Returns the array of colors used in the indicator of this progress indicator. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getIndicatorTrackGapSize()()` Returns the size of the gap between the indicator and track in pixels. | | `https://developer.android.com/reference/com/google/android/material/progressindicator/DeterminateDrawable<S>` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getProgressDrawable()()` | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getShowAnimationBehavior()()` Returns the show animation behavior used in this progress indicator. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getTrackColor()()` Returns the color used in the track of this progress indicator. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getTrackCornerRadius()()` Returns the radius of the rounded corner for the indicator and track in pixels. | | `float` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getTrackCornerRadiusFraction()()` Returns the relative radius of the rounded corner for the indicator and track in pixels. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getTrackThickness()()` Returns the track thickness of this progress indicator in pixels. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getWaveAmplitude()()` Returns the amplitude of the indicator's amplitude in pixels. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getWaveSpeed()()` Returns the speed of the indicator's waveform in pixels. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getWavelengthDeterminate()()` Returns the wavelength, in pixels, of the indicator's waveform in determinate mode. | | `int` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getWavelengthIndeterminate()()` Returns the wavelength, in pixels, of the indicator's waveform in indeterminate mode. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#hide()()` Hides the progress indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#invalidate()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#onAttachedToWindow()()` | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#onDetachedFromWindow()()` | | `synchronized void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#onDraw(Canvas)(Canvas canvas)` | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#onLayout(boolean,int,int,int,int)(boolean changed, int left, int top, int right, int bottom)` | | `synchronized void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#onMeasure(int,int)(int widthMeasureSpec, int heightMeasureSpec)` | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#onVisibilityChanged(View,int)(View changedView, int visibility)` | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#onWindowVisibilityChanged(int)(int visibility)` | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setHideAfterMaxProgress(boolean)(boolean hideAfterMaxProgress)` | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setHideAnimationBehavior(int)(int hideAnimationBehavior)` Sets the hide animation behavior used in this progress indicator. | | `synchronized void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setIndeterminate(boolean)(boolean indeterminate)` Sets the progress mode of the progress indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setIndeterminateAnimatorDurationScale(float)( float indeterminateAnimatorDurationScale )` Sets the scale of the animation duration in indeterminate mode. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setIndeterminateDrawable(Drawable)(Drawable drawable)` Sets a new indeterminate drawable. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setIndicatorColor(int...)(int[] indicatorColors)` Sets the colors used in the indicator of this progress indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setIndicatorTrackGapSize(int)(int indicatorTrackGapSize)` Sets the size of the gap between the indicator and track in pixels. | | `synchronized void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setProgress(int)(int progress)` Sets the current progress to the specified value. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setProgressCompat(int,boolean)(int progress, boolean animated)` Sets the current progress to the specified value with/without animation based on the input. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setProgressDrawable(Drawable)(Drawable drawable)` Sets a new progress drawable. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setShowAnimationBehavior(int)(int showAnimationBehavior)` Sets the show animation behavior used in this progress indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setTrackColor(int)(int trackColor)` Sets the color of the track of this progress indicator. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setTrackCornerRadius(int)(int trackCornerRadius)` Sets the radius of the rounded corner for the indicator and track in pixels. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setTrackCornerRadiusFraction(float)(float fraction)` Sets the radius of the rounded corner for the indicator and track in fraction of track thickness. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setVisibilityAfterHide(int)(int visibility)` Sets the visibility which the component will be after hide animation finishes. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setWaveAmplitude(int)(int waveAmplitude)` Sets the amplitude of the indicator's amplitude in pixels. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setWaveAmplitudeRampProgressMax(float)(float progress)` Sets the progress for ramping down the full wave amplitude. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setWaveAmplitudeRampProgressMin(float)(float progress)` Sets the progress for ramping up the full wave amplitude. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setWaveSpeed(int)(int waveSpeed)` Sets the speed of the indicator's waveform in pixels. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setWavelength(int)(int wavelength)` Sets the wavelength of the indicator's determinate and indeterminate waveform in pixels. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setWavelengthDeterminate(int)(int wavelength)` Sets the wavelength, in pixels, of the indicator's waveform in indeterminate mode. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#setWavelengthIndeterminate(int)(int wavelength)` Sets the wavelength, in pixels, of the indicator's waveform in indeterminate mode. | | `void` | `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#show()()` Shows the progress indicator. | |

## Constants

### DEF_STYLE_RES

```
public static final int DEF_STYLE_RES
```

### INDETERMINATE_ANIMATION_TYPE_ADVANCE

```
public static final int INDETERMINATE_ANIMATION_TYPE_ADVANCE = 0
```

Used in the indeterminate animation type setter for advance animation, which animates an active segment to iteratively grow by modifying the end position and shrink by modifying the start position.

### INDETERMINATE_ANIMATION_TYPE_RETREAT

```
public static final int INDETERMINATE_ANIMATION_TYPE_RETREAT = 1
```

Used in the indeterminate animation type setter for retreat animation, which animates an active segment to iteratively grow and shrink by modifying the end position.

### INDICATOR_DIRECTION_CLOCKWISE

```
public static final int INDICATOR_DIRECTION_CLOCKWISE = 0
```

### INDICATOR_DIRECTION_COUNTERCLOCKWISE

```
public static final int INDICATOR_DIRECTION_COUNTERCLOCKWISE = 1
```

## Public constructors

### CircularProgressIndicator

```
public CircularProgressIndicator(Context context)
```

### CircularProgressIndicator

```
public CircularProgressIndicator(Context context, AttributeSet attrs)
```

### CircularProgressIndicator

```
public CircularProgressIndicator(
    Context context,
    AttributeSet attrs,
    int defStyleAttr
)
```

## Public methods

### getIndeterminateAnimationType

```
public int getIndeterminateAnimationType()
```

Returns the type of indeterminate animation of this progress indicator.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indeterminateAnimationType

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndeterminateAnimationType(int)` |   |

### getIndicatorDirection

```
public int getIndicatorDirection()
```

Returns the indicator animating direction used in this progress indicator.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indicatorDirectionCircular

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndicatorDirection(int)` |   |

### getIndicatorInset

```
public int getIndicatorInset()
```

Returns the inset of this progress indicator.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indicatorInset

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndicatorInset(int)` |   |

### getIndicatorSize

```
public int getIndicatorSize()
```

Returns the size (outer diameter) of this progress indicator.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indicatorSize

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#setIndicatorSize(int)` |   |

### setIndeterminateAnimationType

```
public void setIndeterminateAnimationType(int indeterminateAnimationType)
```

Sets the type of indeterminate animation.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indeterminateAnimationType

| Parameters |
|---|---|
| `int indeterminateAnimationType` | The new type of indeterminate animation. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndeterminateAnimationType()` |   |

### setIndicatorDirection

```
public void setIndicatorDirection(int indicatorDirection)
```

Sets the indicator animating direction used in this progress indicator.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indicatorDirectionCircular

| Parameters |
|---|---|
| `int indicatorDirection` | The new indicator direction. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndicatorDirection()` |   |

### setIndicatorInset

```
public void setIndicatorInset(int indicatorInset)
```

Sets the inset of this progress indicator.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indicatorInset

| Parameters |
|---|---|
| `int indicatorInset` | The new inset in pixels. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndicatorInset()` |   |

### setIndicatorSize

```
public void setIndicatorSize(int indicatorSize)
```

Sets the size (outer diameter) of this circular progress indicator.

ref com.google.android.material.progressindicator.R.styleable#CircularProgressIndicator_indicatorSize

| Parameters |
|---|---|
| `int indicatorSize` | The new size in pixels. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/CircularProgressIndicator#getIndicatorSize()` |   |

### setTrackThickness

```
public void setTrackThickness(int trackThickness)
```

Sets the track thickness of this progress indicator.

ref com.google.android.material.progressindicator.R.styleable#BaseProgressIndicator_trackThickness

| Parameters |
|---|---|
| `int trackThickness` | The new track/indicator thickness in pixel. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if indicator size is less than twice of the track thickness. |

| See also |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/progressindicator/BaseProgressIndicator#getTrackThickness()` |   |