Start a Project

Custom Shapes In JetPack

Custom shapes in jetpack can draw using built-in classes and methods provided by jetpack.

When it comes to attractive design in-app sometimes we need custom shapes that are not directly available in our library.

In jetpack compose, there are some classes/libraries available by using which we can create desired custom shapes like :

RoundedCornerShape()
CutCornerShape()
GenericShape()

RoundedCornerShape

A shape describing the rectangle with rounded corners.

For Example :

In this example, we are applying a rounded corner shape to a box.

Rounded corner shape

CutCornerShape

A shape describing the rectangle with cut corners. Corner size is representing the cut length – the size of both legs of the cut’s right triangle.

For Example :

Cut Corner shape

Circle Shape

For Example :

CIrcle shape

Rectangle Shape

For Example:

Rectangle shape

GenericShape

We can design any custom shape by defining the path.

For Example :

Triangle shape

To know more about the shape in the jetpack, please check the below link

https://developer.android.com/reference/kotlin/androidx/compose/foundation/shape/package-summary

Thank you.

Exit mobile version