Code example for Path

Methods: addRoundRect

0
    } 
    
    @Override 
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
        mClip = new Path();
        RectF rect = new RectF(0, 0, w, h);
        mClip.addRoundRect(rect, RADIUS, RADIUS, Direction.CW);
    } 
  
    @Override 
    protected void dispatchDraw(Canvas canvas) {
        canvas.save();
        canvas.clipPath(mClip);
        super.dispatchDraw(canvas);
        canvas.restore();
    }  
}