# CircularProgressIndicator

# CircularProgressIndicator

Artifact:[androidx.wear.protolayout:protolayout-material](https://developer.android.com/jetpack/androidx/releases/wear-protolayout)  
[View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/material/CircularProgressIndicator.java+class:androidx.wear.protolayout.material.CircularProgressIndicator)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/protolayout/material/CircularProgressIndicator "View this page in Java")

<br />

```
class CircularProgressIndicator : LayoutElementBuilders.LayoutElement
```

<br />

*** ** * ** ***

ProtoLayout component[CircularProgressIndicator](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator)that represents circular progress indicator which supports a gap in the circular track between startAngle and endAngle.

The CircularProgressIndicator is a colored arc around the edge of the screen with the given start and end angles, which can describe a full or partial circle. Behind it is an arc with optional gap representing full progress. The recommended sizes are defined in[ProgressIndicatorDefaults](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/ProgressIndicatorDefaults). Unless specified, the CircularProgressIndicator will have the full length.

The recommended set of[ProgressIndicatorColors](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/ProgressIndicatorColors)can be obtained from[ProgressIndicatorDefaults](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/ProgressIndicatorDefaults), e.g.[DEFAULT_COLORS](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/ProgressIndicatorDefaults#DEFAULT_COLORS())to get a default color scheme for a[CircularProgressIndicator](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator).

When accessing the contents of a container for testing, note that this element can't be simply casted back to the original type, i.e.:  

```kotlin
CircularProgressIndicator cpi = new CircularProgressIndicator...
Box box = new Box.Builder().addContent(cpi).build();

CircularProgressIndicator myCpi = (CircularProgressIndicator) box.getContents().get(0);
```
will fail.

To be able to get[CircularProgressIndicator](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator)object from any layout element,[fromLayoutElement](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#fromLayoutElement(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement))method should be used, i.e.:  

```kotlin
CircularProgressIndicator myCpi =
  CircularProgressIndicator.fromLayoutElement(box.getContents().get(0));
```

## Summary

|                                                                                                                                                      ### Nested types                                                                                                                                                      |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[CircularProgressIndicator.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator.Builder) Builder class for[CircularProgressIndicator](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator) |

|                                                                   ### Public functions                                                                    |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[CircularProgressIndicator](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator)`?` | [fromLayoutElement](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#fromLayoutElement(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement))`(element: `[LayoutElementBuilders.LayoutElement](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement)`)` Returns CircularProgressIndicator object from the given LayoutElement (e.g. one retrieved from a container's content with`container.getContents().get(index)`) if that element can be converted to CircularProgressIndicator. |
| [ProgressIndicatorColors](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/ProgressIndicatorColors)                      | [getCircularProgressIndicatorColors](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#getCircularProgressIndicatorColors())`()` Returns main arc color of this CircularProgressIndicator.                                                                                                                                                                                                                                                                                                                                                              |
| [TypeBuilders.StringProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TypeBuilders.StringProp)`?`                            | [getContentDescription](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#getContentDescription())`()` Returns content description of this CircularProgressIndicator.                                                                                                                                                                                                                                                                                                                                                                                   |
| [DimensionBuilders.DegreesProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/DimensionBuilders.DegreesProp)                   | [getEndAngle](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#getEndAngle())`()` Returns start angle of this CircularProgressIndicator.                                                                                                                                                                                                                                                                                                                                                                                                               |
| [DimensionBuilders.DegreesProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/DimensionBuilders.DegreesProp)                   | [getProgress](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#getProgress())`()` Returns angle representing progressed part of this CircularProgressIndicator.                                                                                                                                                                                                                                                                                                                                                                                        |
| [DimensionBuilders.DegreesProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/DimensionBuilders.DegreesProp)                   | [getStartAngle](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#getStartAngle())`()` Returns start angle of this CircularProgressIndicator.                                                                                                                                                                                                                                                                                                                                                                                                           |
| [DimensionBuilders.DpProp](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/DimensionBuilders.DpProp)                             | [getStrokeWidth](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#getStrokeWidth())`()` Returns stroke width of this CircularProgressIndicator.                                                                                                                                                                                                                                                                                                                                                                                                        |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                                                                       | [isOuterMarginApplied](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/material/CircularProgressIndicator#isOuterMarginApplied())`()` Returns whether there is a margin around this indicator or not.                                                                                                                                                                                                                                                                                                                                                                                    |

## Public functions

### fromLayoutElement

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)  

```
java-static fun fromLayoutElement(element: LayoutElementBuilders.LayoutElement): CircularProgressIndicator?
```

Returns CircularProgressIndicator object from the given LayoutElement (e.g. one retrieved from a container's content with`container.getContents().get(index)`) if that element can be converted to CircularProgressIndicator. Otherwise, it will return null.  

### getCircularProgressIndicatorColors

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)  

```
fun getCircularProgressIndicatorColors(): ProgressIndicatorColors
```

Returns main arc color of this CircularProgressIndicator.  

### getContentDescription

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)  

```
fun getContentDescription(): TypeBuilders.StringProp?
```

Returns content description of this CircularProgressIndicator.  

### getEndAngle

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)  

```
fun getEndAngle(): DimensionBuilders.DegreesProp
```

Returns start angle of this CircularProgressIndicator.  

### getProgress

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)  

```
fun getProgress(): DimensionBuilders.DegreesProp
```

Returns angle representing progressed part of this CircularProgressIndicator.  

### getStartAngle

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)  

```
fun getStartAngle(): DimensionBuilders.DegreesProp
```

Returns start angle of this CircularProgressIndicator.  

### getStrokeWidth

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)  

```
fun getStrokeWidth(): DimensionBuilders.DpProp
```

Returns stroke width of this CircularProgressIndicator.  

### isOuterMarginApplied

Added in[1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.2.0)  

```
fun isOuterMarginApplied(): Boolean
```

Returns whether there is a margin around this indicator or not.