Android How to draw a regular polygon via xml or programical

前端 未结 2 1504
栀梦
栀梦 2021-02-09 22:24

Is there any way to draw polygonal shapes on Android xml layouts?

or is any helper class as library to draw them?

2条回答
  •  礼貌的吻别
    2021-02-09 22:47

    You can create custom drawable and shapes as drawable resources.

    Right click on the "drawable" folder in Android Studio and select New->Drawable Resource File.

    Here is a decent tutorial for shapes and strokes to get started.

    Here is some example shapes ready to use.

    Here is documentation for some more complex things you can do with drawables.

提交回复
热议问题