# LoadingIndicator

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

*** ** * ** ***


```
public final class LoadingIndicator
```

<br />

*** ** * ** ***

This class implements the loading indicators.

## Summary

| ### Public fields |
|---|---|
| `final https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicatorDrawable` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#drawable()` |

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

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#getAccessibilityClassName()()` |
| `int` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#getContainerColor()()` Returns the container color for this loading indicator. |
| `int` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#getContainerHeight()()` Returns the container height for this loading indicator in px. |
| `int` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#getContainerWidth()()` Returns the container width for this loading indicator in px. |
| `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicatorDrawable` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#getDrawable()()` Returns the `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicatorDrawable` object used in this loading indicator. |
| `int[]` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#getIndicatorColor()()` Returns the indicator color(s) for this loading indicator in an int array. |
| `int` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#getIndicatorSize()()` Returns the indicator size for this loading indicator in px. |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#hide()()` Hides the loading indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#invalidateDrawable(Drawable)(Drawable drawable)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#setContainerColor(int)(int containerColor)` Sets a new container color for this loading indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#setContainerHeight(int)(int containerHeight)` Sets a new container height for this loading indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#setContainerWidth(int)(int containerWidth)` Sets a new container width for this loading indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#setIndicatorColor(int...)(int[] indicatorColors)` Sets a new indicator color (or a sequence of indicator colors) for this loading indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#setIndicatorSize(int)(int indicatorSize)` Sets a new indicator size for this loading indicator. |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#show()()` Shows the loading indicator. |

| ### Protected methods |
|---|---|
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#onAttachedToWindow()()` |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#onDraw(Canvas)(Canvas canvas)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#onMeasure(int,int)(int widthMeasureSpec, int heightMeasureSpec)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#onSizeChanged(int,int,int,int)(int w, int h, int oldw, int oldh)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#onVisibilityChanged(View,int)(View changedView, int visibility)` |
| `void` | `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicator#onWindowVisibilityChanged(int)(int visibility)` |

## Public fields

### drawable

```
public final LoadingIndicatorDrawable drawable
```

## Public constructors

### LoadingIndicator

```
public LoadingIndicator(Context context)
```

### LoadingIndicator

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

### LoadingIndicator

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

## Public methods

### getAccessibilityClassName

```
public CharSequence getAccessibilityClassName()
```

### getContainerColor

```
public int getContainerColor()
```

Returns the container color for this loading indicator.

### getContainerHeight

```
public int getContainerHeight()
```

Returns the container height for this loading indicator in px.

### getContainerWidth

```
public int getContainerWidth()
```

Returns the container width for this loading indicator in px.

### getDrawable

```
public LoadingIndicatorDrawable getDrawable()
```

Returns the `https://developer.android.com/reference/com/google/android/material/loadingindicator/LoadingIndicatorDrawable` object used in this loading indicator.

### getIndicatorColor

```
public int[] getIndicatorColor()
```

Returns the indicator color(s) for this loading indicator in an int array.

### getIndicatorSize

```
public int getIndicatorSize()
```

Returns the indicator size for this loading indicator in px.

### hide

```
public void hide()
```

Hides the loading indicator. If `minHideDelay` has been set to a positive value, wait until the delay elapsed before starting the hide action. Otherwise start hiding immediately.

### invalidateDrawable

```
public void invalidateDrawable(Drawable drawable)
```

### setContainerColor

```
public void setContainerColor(int containerColor)
```

Sets a new container color for this loading indicator.

| Parameters |
|---|---|
| `int containerColor` | A new container color. |

### setContainerHeight

```
public void setContainerHeight(int containerHeight)
```

Sets a new container height for this loading indicator.

| Parameters |
|---|---|
| `int containerHeight` | The new container height in px. |

### setContainerWidth

```
public void setContainerWidth(int containerWidth)
```

Sets a new container width for this loading indicator.

| Parameters |
|---|---|
| `int containerWidth` | The new container width in px. |

### setIndicatorColor

```
public void setIndicatorColor(int[] indicatorColors)
```

Sets a new indicator color (or a sequence of indicator colors) for this loading indicator.

| Parameters |
|---|---|
| `int[] indicatorColors` | The new indicator color(s). |

### setIndicatorSize

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

Sets a new indicator size for this loading indicator.

| Parameters |
|---|---|
| `int indicatorSize` | The new indicator size in px. |

### show

```
public void show()
```

Shows the loading indicator. If `showDelay` has been set to a positive value, wait until the delay elapsed before starting the show action. Otherwise start showing immediately.

## Protected methods

### onAttachedToWindow

```
protected void onAttachedToWindow()
```

### onDraw

```
protected void onDraw(Canvas canvas)
```

### onMeasure

```
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
```

### onSizeChanged

```
protected void onSizeChanged(int w, int h, int oldw, int oldh)
```

### onVisibilityChanged

```
protected void onVisibilityChanged(View changedView, int visibility)
```

### onWindowVisibilityChanged

```
protected void onWindowVisibilityChanged(int visibility)
```