# ShapeAppearanceModel

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

*** ** * ** ***


```
public class ShapeAppearanceModel
```

<br />

Known direct subclasses [ShapePathModel](https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel)

|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/ShapePathModel` | **This class is deprecated.** Use `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` instead. <br /> |

*** ** * ** ***

This class models the edges and corners of a shape, which are used by `https://developer.android.com/reference/com/google/android/material/shape/MaterialShapeDrawable` to generate and render the shape for a view's background.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` Builder to create instances of `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel`s. |

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#CORNER_BOTTOM_LEFT() = 4` Flag representing bottom left corner of the shape. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#CORNER_BOTTOM_RIGHT() = 8` Flag representing bottom right corner of the shape. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#CORNER_TOP_LEFT() = 1` Flag representing top left corner of the shape. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#CORNER_TOP_RIGHT() = 2` Flag representing top right corner of the shape. |
| `static final int` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#NUM_CORNERS() = 4` |
| `static final https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#PILL()` |

| ### Public fields |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#bottomEdge()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#bottomLeftCorner()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#bottomLeftCornerSize()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#bottomRightCorner()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#bottomRightCornerSize()` |
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#leftEdge()` |
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#rightEdge()` |
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#topEdge()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#topLeftCorner()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#topLeftCornerSize()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#topRightCorner()` |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#topRightCornerSize()` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#ShapeAppearanceModel()()` Constructs a default path generator with default edge and corner treatments. |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#builder()()` |
| `static https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#builder(Theme,int)(Theme theme, int shapeAppearanceResId)` This builder only takes in a single shape appearance, no shape appearance overlay. |
| `static https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#builder(Context,int,int)( Context context, int shapeAppearanceResId, int shapeAppearanceOverlayResId )` |
| `static https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#builder(Context,AttributeSet,int,int)( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes )` |
| `static https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#builder(Context,AttributeSet,int,int,com.google.android.material.shape.CornerSize)( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, https://developer.android.com/reference/com/google/android/material/shape/CornerSize defaultCornerSize )` |
| `static https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#builder(Context,AttributeSet,int,int,int)( Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int defaultCornerSize )` |
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getBottomEdge()()` Gets the edge treatment for the bottom edge. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getBottomLeftCorner()()` Gets the corner treatment for the bottom left corner. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getBottomLeftCornerSize()()` Gets the corner size for the bottom left corner. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getBottomRightCorner()()` Gets the corner treatment for the bottom right corner. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getBottomRightCornerSize()()` Gets the corner size for the bottom right corner. |
| `static https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getCornerSize(TypedArray,int,com.google.android.material.shape.CornerSize)(TypedArray a, int index, https://developer.android.com/reference/com/google/android/material/shape/CornerSize defaultValue)` |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getDefaultShape()()` Returns the shape as a `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` of the ShapeAppearance, or the default shape if there are multiple shapes for different states. |
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getLeftEdge()()` Gets the edge treatment for the left edge. |
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getRightEdge()()` Gets the edge treatment for the right edge. |
| `ShapeAppearanceModel[]` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getShapeAppearanceModels()()` Returns a list of the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` of all states. |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getShapeForState(int[])(int[] stateSet)` Returns a `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` for the given state set. |
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getTopEdge()()` Gets the edge treatment for the top edge. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getTopLeftCorner()()` Gets the corner treatment for the top left corner. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getTopLeftCornerSize()()` Gets the corner size for the top left corner. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getTopRightCorner()()` Gets the corner treatment for the top right corner. |
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#getTopRightCornerSize()()` Gets the corner size for the top right corner. |
| `boolean` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#isStateful()()` Whether or not the ShapeAppearance provides different shapes for states. |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel.Builder` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#toBuilder()()` Returns a builder with the edges and corners from this `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#toString()()` |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#withCornerSize(com.google.android.material.shape.CornerSize)(https://developer.android.com/reference/com/google/android/material/shape/CornerSize cornerSize)` Returns a new `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` with the same edges and corners as the default shape, but with the corner size for all corners updated. |
| `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` | `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel#withCornerSize(float)(float cornerSize)` Returns a copy of this `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` with the same edges and corners, but with the corner size for all corners updated. |

## Constants

### CORNER_BOTTOM_LEFT

```
public static final int CORNER_BOTTOM_LEFT = 4
```

Flag representing bottom left corner of the shape.

### CORNER_BOTTOM_RIGHT

```
public static final int CORNER_BOTTOM_RIGHT = 8
```

Flag representing bottom right corner of the shape.

### CORNER_TOP_LEFT

```
public static final int CORNER_TOP_LEFT = 1
```

Flag representing top left corner of the shape.

### CORNER_TOP_RIGHT

```
public static final int CORNER_TOP_RIGHT = 2
```

Flag representing top right corner of the shape.

### NUM_CORNERS

```
public static final int NUM_CORNERS = 4
```

### PILL

```
public static final CornerSize PILL
```

## Public fields

### bottomEdge

```
public EdgeTreatment bottomEdge
```

### bottomLeftCorner

```
public CornerTreatment bottomLeftCorner
```

### bottomLeftCornerSize

```
public CornerSize bottomLeftCornerSize
```

### bottomRightCorner

```
public CornerTreatment bottomRightCorner
```

### bottomRightCornerSize

```
public CornerSize bottomRightCornerSize
```

### leftEdge

```
public EdgeTreatment leftEdge
```

### rightEdge

```
public EdgeTreatment rightEdge
```

### topEdge

```
public EdgeTreatment topEdge
```

### topLeftCorner

```
public CornerTreatment topLeftCorner
```

### topLeftCornerSize

```
public CornerSize topLeftCornerSize
```

### topRightCorner

```
public CornerTreatment topRightCorner
```

### topRightCornerSize

```
public CornerSize topRightCornerSize
```

## Public constructors

### ShapeAppearanceModel

```
public ShapeAppearanceModel()
```

Constructs a default path generator with default edge and corner treatments.

## Public methods

### builder

```
public static ShapeAppearanceModel.Builder builder()
```

### builder

```
public static ShapeAppearanceModel.Builder builder(Theme theme, int shapeAppearanceResId)
```

This builder only takes in a single shape appearance, no shape appearance overlay. Additionally, it does not use ContextThemeWrapper like the other builders, meaning XML @macro usages in the shape appearance are not supported, due to b/230755281.

### builder

```
public static ShapeAppearanceModel.Builder builder(
    Context context,
    int shapeAppearanceResId,
    int shapeAppearanceOverlayResId
)
```

### builder

```
public static ShapeAppearanceModel.Builder builder(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)
```

### builder

```
public static ShapeAppearanceModel.Builder builder(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes,
    CornerSize defaultCornerSize
)
```

### builder

```
public static ShapeAppearanceModel.Builder builder(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes,
    int defaultCornerSize
)
```

### getBottomEdge

```
public EdgeTreatment getBottomEdge()
```

Gets the edge treatment for the bottom edge.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | the edge treatment for the bottom edge. |

### getBottomLeftCorner

```
public CornerTreatment getBottomLeftCorner()
```

Gets the corner treatment for the bottom left corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | the corner treatment for the bottom left corner. |

### getBottomLeftCornerSize

```
public CornerSize getBottomLeftCornerSize()
```

Gets the corner size for the bottom left corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | the corner size for the bottom left corner. |

### getBottomRightCorner

```
public CornerTreatment getBottomRightCorner()
```

Gets the corner treatment for the bottom right corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | the corner treatment for the bottom right corner. |

### getBottomRightCornerSize

```
public CornerSize getBottomRightCornerSize()
```

Gets the corner size for the bottom right corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | the corner size for the bottom right corner. |

### getCornerSize

```
public static CornerSize getCornerSize(TypedArray a, int index, CornerSize defaultValue)
```

### getDefaultShape

```
public ShapeAppearanceModel getDefaultShape()
```

Returns the shape as a `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` of the ShapeAppearance, or the default shape if there are multiple shapes for different states.

### getLeftEdge

```
public EdgeTreatment getLeftEdge()
```

Gets the edge treatment for the left edge.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | the edge treatment for the left edge. |

### getRightEdge

```
public EdgeTreatment getRightEdge()
```

Gets the edge treatment for the right edge.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | the edge treatment for the right edge. |

### getShapeAppearanceModels

```
public ShapeAppearanceModel[] getShapeAppearanceModels()
```

Returns a list of the `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` of all states. If this ShapeAppearance is stateless, this will be a list of just the default shape.

### getShapeForState

```
public ShapeAppearanceModel getShapeForState(int[] stateSet)
```

Returns a `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` for the given state set.

### getTopEdge

```
public EdgeTreatment getTopEdge()
```

Gets the edge treatment for the top edge.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/EdgeTreatment` | the edge treatment for the top edge. |

### getTopLeftCorner

```
public CornerTreatment getTopLeftCorner()
```

Gets the corner treatment for the top left corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | the corner treatment for the top left corner. |

### getTopLeftCornerSize

```
public CornerSize getTopLeftCornerSize()
```

Gets the corner size for the top left corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | the corner size for the top left corner. |

### getTopRightCorner

```
public CornerTreatment getTopRightCorner()
```

Gets the corner treatment for the top right corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerTreatment` | the corner treatment for the top right corner. |

### getTopRightCornerSize

```
public CornerSize getTopRightCornerSize()
```

Gets the corner size for the top right corner.

| Returns |
|---|---|
| `https://developer.android.com/reference/com/google/android/material/shape/CornerSize` | the corner size for the top right corner. |

### isStateful

```
public boolean isStateful()
```

Whether or not the ShapeAppearance provides different shapes for states.

### toBuilder

```
public ShapeAppearanceModel.Builder toBuilder()
```

Returns a builder with the edges and corners from this `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel`

### toString

```
public String toString()
```

### withCornerSize

```
public ShapeAppearanceModel withCornerSize(CornerSize cornerSize)
```

Returns a new `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` with the same edges and corners as the default shape, but with the corner size for all corners updated.

### withCornerSize

```
public ShapeAppearanceModel withCornerSize(float cornerSize)
```

Returns a copy of this `https://developer.android.com/reference/com/google/android/material/shape/ShapeAppearanceModel` with the same edges and corners, but with the corner size for all corners updated.