Skip to main content

Posts

Showing posts with the label ondraw

[Android] How to fill outside of drawing with Paint

Android provides many drawing actions via paint. It has several features which provide great flexibility. I have needed a feature nowadays, such that a user can draw shapes or lines. At the end of the job, a user should be able to change color of outside part of drawing. Figure 1 : Example output For this picture, the drawing is obvious, its color is black. Filled place is the whole view that contains the drawing but the shape itself and its inside. The code below will result this functionality when used in onDraw() method: