How to create custom ShapeDrawable in Android

137 views Asked by At

I am working with ShapeDrawables in Android (Kotlin), specifically Circles and Squares that are moving on canvas. But I need other shapes (like triangle, or hexagon), which I failed to create. I am creating those shapes using:

val shapeDrawable = ShapeDrawable(RectShape())

Is there something like Shape(customTriangleDefinition), so I could do the following?

val shapeDrawable = ShapeDrawable(Shape(customTriangleDefinition))

I tried to Google it but haven’t find any solution.
Thank you for any responses.

0

There are 0 answers