# MaterialShapeUtils

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

*** ** * ** ***


```
public class MaterialShapeUtils
```

<br />

*** ** * ** ***

Utility methods for `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` and related classes.

## Summary

| ### Public methods |
|---|---|
| `static void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeUtils#setElevation(View,float)(View view, float elevation)` If the background of the provided `view` is a `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable`, sets the drawable's elevation via `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setElevation(float)`; otherwise does nothing. |
| `static void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeUtils#setParentAbsoluteElevation(View)(View view)` If the background of the provided `view` is a `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable`, sets the drawable's parent absolute elevation (see `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeUtils#setParentAbsoluteElevation(View,com.google.android.material.shape.MaterialShapeDrawable)`); otherwise does nothing. |
| `static void` | `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeUtils#setParentAbsoluteElevation(View,com.google.android.material.shape.MaterialShapeDrawable)( View view, https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable materialShapeDrawable )` Updates the `materialShapeDrawable` parent absolute elevation via `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setParentAbsoluteElevation(float)` to be equal to the absolute elevation of the parent of the provided `view`. |

## Public methods

### setElevation

```
public static void setElevation(View view, float elevation)
```

If the background of the provided `view` is a `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable`, sets the drawable's elevation via `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setElevation(float)`; otherwise does nothing.

### setParentAbsoluteElevation

```
public static void setParentAbsoluteElevation(View view)
```

If the background of the provided `view` is a `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable`, sets the drawable's parent absolute elevation (see `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeUtils#setParentAbsoluteElevation(View,com.google.android.material.shape.MaterialShapeDrawable)`); otherwise does nothing.

### setParentAbsoluteElevation

```
public static void setParentAbsoluteElevation(
    View view,
    MaterialShapeDrawable materialShapeDrawable
)
```

Updates the `materialShapeDrawable` parent absolute elevation via `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable#setParentAbsoluteElevation(float)` to be equal to the absolute elevation of the parent of the provided `view`.