Question: Write an onDraw() method of a custom view that will draw 16 grey squares arranged in a 4x4 pattern with a red dot of 20
Write an onDraw() method of a custom view that will draw 16 grey squares arranged in a 4x4 pattern with a red dot of 20 pixel radius in the middle of each. Note that you are required to use the matrix stack to move to each rectangle, then draw it, draw the circle in the middle of the square and then return to the origin. A filled circle may be drawn using a call to: drawCircle(cx, cy, radius, paint); You are provided with the following variables. canvas: a Canvas object that can be queried for dimensions and draw basic primitives square: A Rect object that will be used to draw squares p: A paint object set to GRAY red: A paint object set to RED
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
