ShapeAppearanceModel
public
class
ShapeAppearanceModel
extends Object
java.lang.Object | |
↳ | com.google.android.material.shape.ShapeAppearanceModel |
This class models the edges and corners of a shape, which are used by MaterialShapeDrawable
to generate and render the shape for a view's background.
Summary
Nested classes | |
---|---|
class |
ShapeAppearanceModel.Builder
Builder to create instances of |
Fields | |
---|---|
public
static
final
CornerSize |
PILL
|
Public constructors | |
---|---|
ShapeAppearanceModel()
Constructs a default path generator with default edge and corner treatments. |
Public methods | |
---|---|
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)
|
static
ShapeAppearanceModel.Builder
|
builder(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
|
static
ShapeAppearanceModel.Builder
|
builder(Context context, int shapeAppearanceResId, int shapeAppearanceOverlayResId)
|
static
ShapeAppearanceModel.Builder
|
builder()
|
EdgeTreatment
|
getBottomEdge()
Gets the edge treatment for the bottom edge. |
CornerTreatment
|
getBottomLeftCorner()
Gets the corner treatment for the bottom left corner. |
CornerSize
|
getBottomLeftCornerSize()
Gets the corner size for the bottom left corner. |
CornerTreatment
|
getBottomRightCorner()
Gets the corner treatment for the bottom right corner. |
CornerSize
|
getBottomRightCornerSize()
Gets the corner size for the bottom right corner. |
EdgeTreatment
|
getLeftEdge()
Gets the edge treatment for the left edge. |
EdgeTreatment
|
getRightEdge()
Gets the edge treatment for the right edge. |
EdgeTreatment
|
getTopEdge()
Gets the edge treatment for the top edge. |
CornerTreatment
|
getTopLeftCorner()
Gets the corner treatment for the top left corner. |
CornerSize
|
getTopLeftCornerSize()
Gets the corner size for the top left corner. |
CornerTreatment
|
getTopRightCorner()
Gets the corner treatment for the top right corner. |
CornerSize
|
getTopRightCornerSize()
Gets the corner size for the top right corner. |
ShapeAppearanceModel.Builder
|
toBuilder()
Returns a builder with the edges and corners from this |
ShapeAppearanceModel
|
withCornerSize(float cornerSize)
Returns a copy of this |
ShapeAppearanceModel
|
withCornerSize(CornerSize cornerSize)
|
Inherited methods | |
---|---|
Fields
Public constructors
ShapeAppearanceModel
public ShapeAppearanceModel ()
Constructs a default path generator with default edge and corner treatments.
Public methods
builder
public static ShapeAppearanceModel.Builder builder (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, CornerSize defaultCornerSize)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
defStyleAttr |
int |
defStyleRes |
int |
defaultCornerSize |
CornerSize |
Returns | |
---|---|
ShapeAppearanceModel.Builder |
builder
public static ShapeAppearanceModel.Builder builder (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes, int defaultCornerSize)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
defStyleAttr |
int |
defStyleRes |
int |
defaultCornerSize |
int |
Returns | |
---|---|
ShapeAppearanceModel.Builder |
builder
public static ShapeAppearanceModel.Builder builder (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Parameters | |
---|---|
context |
Context |
attrs |
AttributeSet |
defStyleAttr |
int |
defStyleRes |
int |
Returns | |
---|---|
ShapeAppearanceModel.Builder |
builder
public static ShapeAppearanceModel.Builder builder (Context context, int shapeAppearanceResId, int shapeAppearanceOverlayResId)
Parameters | |
---|---|
context |
Context |
shapeAppearanceResId |
int |
shapeAppearanceOverlayResId |
int |
Returns | |
---|---|
ShapeAppearanceModel.Builder |
getBottomEdge
public EdgeTreatment getBottomEdge ()
Gets the edge treatment for the bottom edge.
Returns | |
---|---|
EdgeTreatment |
the edge treatment for the bottom edge. |
getBottomLeftCorner
public CornerTreatment getBottomLeftCorner ()
Gets the corner treatment for the bottom left corner.
Returns | |
---|---|
CornerTreatment |
the corner treatment for the bottom left corner. |
getBottomLeftCornerSize
public CornerSize getBottomLeftCornerSize ()
Gets the corner size for the bottom left corner.
Returns | |
---|---|
CornerSize |
the corner size for the bottom left corner. |
getBottomRightCorner
public CornerTreatment getBottomRightCorner ()
Gets the corner treatment for the bottom right corner.
Returns | |
---|---|
CornerTreatment |
the corner treatment for the bottom right corner. |
getBottomRightCornerSize
public CornerSize getBottomRightCornerSize ()
Gets the corner size for the bottom right corner.
Returns | |
---|---|
CornerSize |
the corner size for the bottom right corner. |
getLeftEdge
public EdgeTreatment getLeftEdge ()
Gets the edge treatment for the left edge.
Returns | |
---|---|
EdgeTreatment |
the edge treatment for the left edge. |
getRightEdge
public EdgeTreatment getRightEdge ()
Gets the edge treatment for the right edge.
Returns | |
---|---|
EdgeTreatment |
the edge treatment for the right edge. |
getTopEdge
public EdgeTreatment getTopEdge ()
Gets the edge treatment for the top edge.
Returns | |
---|---|
EdgeTreatment |
the edge treatment for the top edge. |
getTopLeftCorner
public CornerTreatment getTopLeftCorner ()
Gets the corner treatment for the top left corner.
Returns | |
---|---|
CornerTreatment |
the corner treatment for the top left corner. |
getTopLeftCornerSize
public CornerSize getTopLeftCornerSize ()
Gets the corner size for the top left corner.
Returns | |
---|---|
CornerSize |
the corner size for the top left corner. |
getTopRightCorner
public CornerTreatment getTopRightCorner ()
Gets the corner treatment for the top right corner.
Returns | |
---|---|
CornerTreatment |
the corner treatment for the top right corner. |
getTopRightCornerSize
public CornerSize getTopRightCornerSize ()
Gets the corner size for the top right corner.
Returns | |
---|---|
CornerSize |
the corner size for the top right corner. |
toBuilder
public ShapeAppearanceModel.Builder toBuilder ()
Returns a builder with the edges and corners from this ShapeAppearanceModel
Returns | |
---|---|
ShapeAppearanceModel.Builder |
withCornerSize
public 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.
Parameters | |
---|---|
cornerSize |
float |
Returns | |
---|---|
ShapeAppearanceModel |
withCornerSize
public ShapeAppearanceModel withCornerSize (CornerSize cornerSize)
Parameters | |
---|---|
cornerSize |
CornerSize |
Returns | |
---|---|
ShapeAppearanceModel |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2021-02-08 UTC.