title: Draw round corners on top left top right bottom left bottom right using Path and RectF in Android
body: <p>By making a <a href="https://stackoverflow.com/a/40150715/2069407">custom ImageView</a> and override the onDraw method with the following will make the ImageView to have rounded corners. Reference</p>
  
  <pre><code>@Override
  protected void onDraw(Canvas canvas) {
      float radius = getContext().getResources().getDimension(R.dimen.round_corner_radius);
      Path path = new Path();
      RectF rect = new RectF(0, 0, this.getWidth(), this.getHeight());
      path.addRoundRect(rect, radius, radius, Path.Direction.CW);
      canvas.clipPath(path);
      super.onDraw(canvas);
  }
  </code></pre>
  
  <p>How can I selectively make the round corners instead of making all four corners round. For example, only making the top left and top right corners round and leave the bottom corners intact. Here is a <a href="https://stackoverflow.com/a/5252726/2069407">solution</a> to do to through Bitmap. I am looking for doing it in this onDraw method and only using Path and RectF.</p>