Scaling a Custom View
I have a custom view (I inherit from View
) that I want the user to be able to scale using layout_width
& layout_height
. I am not sure if this is something that should be done in OnMeasure()
, OnDraw()
, or somewhere else. If I change the values in SetMeasuredDimension()
in OnMeasure()
, it changes the boundaries of the layout, but the items drawn on the Canvas
in OnDraw()
remain the same size (although the View
may be cropped or padded based on these values). I know that the user can resize the View
using the scaleX
& scaleY
properties in XML, but this is very inefficient. How can I adjust the size of the View
based on layout_width
& layout_height
?