I have a RoundRectShape
that is drawn in a View
\'s onDraw()
function.
The corners of this shape are modified by any drag acti
I think you don't need to use RoundRectShape
at all. RoundRectShape
is immutable so the only way to change its values is to use reflection.
You can easily accomplish the same drawnings by calling Canvas.drawRoundRect(RectF rect, float rx, float ry, Paint paint)
method directly without using RoundRectShape
. Or you can look at RoundRectShape
implementation and just use its code in your onDraw()
method.
EDIT:
The comments about RoundRectShape
not being the right way to go and looking at the implementation were right. Following the implementation found a call to:
mPath.addRoundedRect()
which has a variation allowing a float of corner radii as the input (Path.addRoundRect)
In answering the question:
Use a path instead of a shape as the variable and draw the new Rounded Rectangle to the path when necessary