ShapePathModel

public class ShapePathModel extends ShapeAppearanceModel


This class models the edges and corners of a shape, which are used by to generate and render the shape for a view's background.

Summary

Public constructors

Public methods

void
setAllCorners(CornerTreatment cornerTreatment)

This method is deprecated.

Use ShapeAppearanceModel instead.

void
setAllEdges(EdgeTreatment edgeTreatment)

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

void
setCornerTreatments(
    CornerTreatment topLeftCorner,
    CornerTreatment topRightCorner,
    CornerTreatment bottomRightCorner,
    CornerTreatment bottomLeftCorner
)

This method is deprecated.

Use ShapeAppearanceModel instead.

void
setEdgeTreatments(
    EdgeTreatment leftEdge,
    EdgeTreatment topEdge,
    EdgeTreatment rightEdge,
    EdgeTreatment bottomEdge
)

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

void

This method is deprecated.

Use ShapeAppearanceModel instead.

Inherited Constants

From com.google.android.material.shape.ShapeAppearanceModel
static final int
static final CornerSize

Inherited methods

From com.google.android.material.shape.ShapeAppearanceModel
static ShapeAppearanceModel.Builder
static ShapeAppearanceModel.Builder
builder(
    Context context,
    int shapeAppearanceResId,
    int shapeAppearanceOverlayResId
)
static ShapeAppearanceModel.Builder
builder(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes
)
static ShapeAppearanceModel.Builder
builder(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes,
    CornerSize defaultCornerSize
)
static ShapeAppearanceModel.Builder
builder(
    Context context,
    AttributeSet attrs,
    int defStyleAttr,
    int defStyleRes,
    int defaultCornerSize
)
EdgeTreatment

Gets the edge treatment for the bottom edge.

CornerTreatment

Gets the corner treatment for the bottom left corner.

CornerSize

Gets the corner size for the bottom left corner.

CornerTreatment

Gets the corner treatment for the bottom right corner.

CornerSize

Gets the corner size for the bottom right corner.

static CornerSize
getCornerSize(TypedArray a, int index, CornerSize defaultValue)
EdgeTreatment

Gets the edge treatment for the left edge.

EdgeTreatment

Gets the edge treatment for the right edge.

EdgeTreatment

Gets the edge treatment for the top edge.

CornerTreatment

Gets the corner treatment for the top left corner.

CornerSize

Gets the corner size for the top left corner.

CornerTreatment

Gets the corner treatment for the top right corner.

CornerSize

Gets the corner size for the top right corner.

ShapeAppearanceModel.Builder

Returns a builder with the edges and corners from this ShapeAppearanceModel

String
ShapeAppearanceModel
ShapeAppearanceModel
withCornerSize(float cornerSize)

Returns a copy of this ShapeAppearanceModel with the same edges and corners, but with the corner size for all corners updated.

Public constructors

ShapePathModel

public ShapePathModel()

Public methods

setAllCorners

public void setAllCorners(CornerTreatment cornerTreatment)

Set all corner treatments.

Parameters
CornerTreatment cornerTreatment

the corner treatment to use in all four corners.

setAllEdges

public void setAllEdges(EdgeTreatment edgeTreatment)

Set all edge treatments.

Parameters
EdgeTreatment edgeTreatment

the edge treatment to use for all four edges.

setBottomEdge

public void setBottomEdge(EdgeTreatment bottomEdge)

Set the edge treatment for the bottom edge.

Parameters
EdgeTreatment bottomEdge

the desired treatment.

setBottomLeftCorner

public void setBottomLeftCorner(CornerTreatment bottomLeftCorner)

Set the corner treatment for the bottom-left corner.

Parameters
CornerTreatment bottomLeftCorner

the desired treatment.

setBottomRightCorner

public void setBottomRightCorner(CornerTreatment bottomRightCorner)

Set the corner treatment for the bottom-right corner.

Parameters
CornerTreatment bottomRightCorner

the desired treatment.

setCornerTreatments

public void setCornerTreatments(
    CornerTreatment topLeftCorner,
    CornerTreatment topRightCorner,
    CornerTreatment bottomRightCorner,
    CornerTreatment bottomLeftCorner
)

Set corner treatments.

Parameters
CornerTreatment topLeftCorner

the corner treatment to use in the top-left corner.

CornerTreatment topRightCorner

the corner treatment to use in the top-right corner.

CornerTreatment bottomRightCorner

the corner treatment to use in the bottom-right corner.

CornerTreatment bottomLeftCorner

the corner treatment to use in the bottom-left corner.

setEdgeTreatments

public void setEdgeTreatments(
    EdgeTreatment leftEdge,
    EdgeTreatment topEdge,
    EdgeTreatment rightEdge,
    EdgeTreatment bottomEdge
)

Set edge treatments.

Parameters
EdgeTreatment leftEdge

the edge treatment to use on the left edge.

EdgeTreatment topEdge

the edge treatment to use on the top edge.

EdgeTreatment rightEdge

the edge treatment to use on the right edge.

EdgeTreatment bottomEdge

the edge treatment to use on the bottom edge.

setLeftEdge

public void setLeftEdge(EdgeTreatment leftEdge)

Set the edge treatment for the left edge.

Parameters
EdgeTreatment leftEdge

the desired treatment.

setRightEdge

public void setRightEdge(EdgeTreatment rightEdge)

Set the edge treatment for the right edge.

Parameters
EdgeTreatment rightEdge

the desired treatment.

setTopEdge

public void setTopEdge(EdgeTreatment topEdge)

Set the edge treatment for the top edge.

Parameters
EdgeTreatment topEdge

the desired treatment.

setTopLeftCorner

public void setTopLeftCorner(CornerTreatment topLeftCorner)

Set the corner treatment for the top-left corner.

Parameters
CornerTreatment topLeftCorner

the desired treatment.

setTopRightCorner

public void setTopRightCorner(CornerTreatment topRightCorner)

Set the corner treatment for the top-right corner.

Parameters
CornerTreatment topRightCorner

the desired treatment.