Android Setting up Paint for drawing shapes


  • setStyle(Paint.Style style) Filled shape FILL, Stroke shape STROKE, or both FILL_AND_STROKE
  • setColor(int color) Set the paint drawing color. You can also use setARGB(int a, int r, int g, int b and setAlpha(int alpha)
  • setStrokeCap(Paint.Cap cap) Set line caps, either ROUND, SQUARE, or BUTT (none) See this.
  • setStrokeJoin(Paint.Join join) Set line joins, either MITER (pointy), ROUND, or BEVEL. See this.
  • setStrokeMiter(float miter) Set miter join limit. This can prevent miter join from going on indefinitively, turning it into a bevel join after x pixels. See this.
  • setStrokeWidth(float width) Set stroke width. 0 will draw in hairline mode, independant of the canvas matrix. (always 1 pixel)