Custom Shapes In JetPack

Updated 31 March 2022

Save

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 custom shapes in jetpack
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  custom shapes in jetpack
Cut Corner shape

Circle Shape

For Example :

circle shape
CIrcle shape

Rectangle Shape

For Example:

Rectangle shape  custom shapes in jetpack
Rectangle shape

GenericShape

We can design any custom shape by defining the path.

For Example :

custom triangle shape  custom shapes in jetpack
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.

author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project


    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home