Code example for PathShape

0
			Path p = new Path();
			p.moveTo(0, 0);
			p.lineTo(width, 0);
			p.lineTo(width / 2, height);
			p.lineTo(0, 0);
			shape = new ShapeDrawable(new PathShape(p, width, height));
			shape.getPaint().setColor(Color.BLACK);
			shape.setBounds(0, 0, width, height);
 
		} 
 
		public void setColor(int color) {
			shape.getPaint().setColor(color);
		} 
		 
		protected Drawable getDrawable() {
 
			Canvas canvas = new Canvas();
			shape.draw(canvas);
			this.onDraw(canvas);
Experience pair programming with AI  Get Codota for Java