开发者

Android add Stroke to Drawable on Runtime

开发者 https://www.devze.com 2023-02-06 19:57 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消