简体   繁体   中英

How to create and use custom shape, i.e Constant as a drawable shape for GradientDrawable in Android?

GradientDrawable Class in Android allows with the constants(Shapes) like Oval, Rectangle etc. Is there any way to add few more shapes like circle or triangle or any other shape so that we can make its look and feel more attractive. Also suggest if there is any other Class to be used and the way it is used.

Thanks in advance.

您可以使用:

 final GradientDrawable drawable = (GradientDrawable) ResourcesCompat.getDrawable(getResources(), R.drawable.rect_shape, null);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM