Android Draw Custom Shape

时间:2017-01-18 13:54:39

标签: android android-layout android-drawable drawrectangle android-custom-drawable

我是android的新手,你可以指导我如何在android中绘制以下形状吗?我将不胜感激任何帮助。感谢。enter image description here

1 个答案:

答案 0 :(得分:2)

public class CustomView extends View{

   public onDraw(Canvas canvas){
     // Take paint object
      Paint fillBackgroundPaint = new Paint();
      fillBackgroundPaint.setColor(ContextCompat.getColor(context, R.color.black));

      // Draw lines and Rectangles by using the below methods on canvas
      canvas.drawLine()
      canvas.drawRect()

     }
   }