简体   繁体   中英

Android add Stroke to Drawable on Runtime

I found this function. How can I now add a Stroke to my Drawable?
There is nothing like setStroke(...)

Try creating a paint variable with the your intended color/stroke width/ (also set style=stroke) and then use it in the onDraw method:

onDraw(Shape shape, Canvas canvas, Paint paint)

In this way, the stroke will be added when you draw. It will not be attached to your Drawable.

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