{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

Shapes

public final class Shapes


Material surfaces can be displayed in different shapes. Shapes direct attention, identify components, communicate state, and express brand.

The shape scale defines the style of container corners, offering a range of roundedness from square to fully circular.

There are different sizes of shapes:

You can customize the shape system for all components in the MaterialTheme or you can do it on a per component basis.

You can change the shape that a component has by overriding the shape parameter for that component. For example, by default, buttons use the shape style “full.” If your product requires a smaller amount of roundedness, you can override the shape parameter with a different shape value like MaterialTheme.shapes.small.

To learn more about shapes, see Material Design shapes.

Summary

Public constructors

Shapes(
    @NonNull CornerBasedShape extraSmall,
    @NonNull CornerBasedShape small,
    @NonNull CornerBasedShape medium,
    @NonNull CornerBasedShape large,
    @NonNull CornerBasedShape extraLarge
)

Public methods

final @NonNull Shapes
copy(
    @NonNull CornerBasedShape extraSmall,
    @NonNull CornerBasedShape small,
    @NonNull CornerBasedShape medium,
    @NonNull CornerBasedShape large,
    @NonNull CornerBasedShape extraLarge
)

Returns a copy of this Shapes, optionally overriding some of the values.

boolean
equals(Object other)
final @NonNull CornerBasedShape

A shape style with 4 same-sized corners whose size are bigger than Shapes.large and smaller than CircleShape.

final @NonNull CornerBasedShape

A shape style with 4 same-sized corners whose size are bigger than RectangleShape and smaller than Shapes.small.

final @NonNull CornerBasedShape

A shape style with 4 same-sized corners whose size are bigger than Shapes.medium and smaller than Shapes.extraLarge.

final @NonNull CornerBasedShape

A shape style with 4 same-sized corners whose size are bigger than Shapes.small and smaller than Shapes.large.

final @NonNull CornerBasedShape

A shape style with 4 same-sized corners whose size are bigger than Shapes.extraSmall and smaller than Shapes.medium.

int
@NonNull String

Public constructors

Shapes

public Shapes(
    @NonNull CornerBasedShape extraSmall,
    @NonNull CornerBasedShape small,
    @NonNull CornerBasedShape medium,
    @NonNull CornerBasedShape large,
    @NonNull CornerBasedShape extraLarge
)
Parameters
@NonNull CornerBasedShape extraSmall

A shape style with 4 same-sized corners whose size are bigger than RectangleShape and smaller than Shapes.small. By default autocomplete menu, select menu, snackbars, standard menu, and text fields use this shape.

@NonNull CornerBasedShape small

A shape style with 4 same-sized corners whose size are bigger than Shapes.extraSmall and smaller than Shapes.medium. By default chips use this shape.

@NonNull CornerBasedShape medium

A shape style with 4 same-sized corners whose size are bigger than Shapes.small and smaller than Shapes.large. By default cards and small FABs use this shape.

@NonNull CornerBasedShape large

A shape style with 4 same-sized corners whose size are bigger than Shapes.medium and smaller than Shapes.extraLarge. By default extended FABs, FABs, and navigation drawers use this shape.

@NonNull CornerBasedShape extraLarge

A shape style with 4 same-sized corners whose size are bigger than Shapes.large and smaller than CircleShape. By default large FABs use this shape.

Public methods

copy

public final @NonNull Shapes copy(
    @NonNull CornerBasedShape extraSmall,
    @NonNull CornerBasedShape small,
    @NonNull CornerBasedShape medium,
    @NonNull CornerBasedShape large,
    @NonNull CornerBasedShape extraLarge
)

Returns a copy of this Shapes, optionally overriding some of the values.

equals

public boolean equals(Object other)

getExtraLarge

public final @NonNull CornerBasedShape getExtraLarge()

A shape style with 4 same-sized corners whose size are bigger than Shapes.large and smaller than CircleShape. By default large FABs use this shape.

getExtraSmall

public final @NonNull CornerBasedShape getExtraSmall()

A shape style with 4 same-sized corners whose size are bigger than RectangleShape and smaller than Shapes.small. By default autocomplete menu, select menu, snackbars, standard menu, and text fields use this shape.

getLarge

public final @NonNull CornerBasedShape getLarge()

A shape style with 4 same-sized corners whose size are bigger than Shapes.medium and smaller than Shapes.extraLarge. By default extended FABs, FABs, and navigation drawers use this shape.

getMedium

public final @NonNull CornerBasedShape getMedium()

A shape style with 4 same-sized corners whose size are bigger than Shapes.small and smaller than Shapes.large. By default cards and small FABs use this shape.

getSmall

public final @NonNull CornerBasedShape getSmall()

A shape style with 4 same-sized corners whose size are bigger than Shapes.extraSmall and smaller than Shapes.medium. By default chips use this shape.

hashCode

public int hashCode()

toString

public @NonNull String toString()