Created
December 7, 2016 19:10
-
-
Save muthuraj57/fae67986e88446000046ed3d83309be2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onDraw(Canvas canvas) { | |
if (shape == RECTANGLE) { | |
canvas.drawRoundRect(rectF, cornerRadius, cornerRadius, borderPaint); | |
clipPath.addRoundRect(rectF, cornerRadius, cornerRadius, Path.Direction.CW); | |
} else { | |
canvas.drawCircle(rectF.centerX(), rectF.centerY(), (rectF.height() / 2) - borderWidth, borderPaint); | |
clipPath.addCircle(rectF.centerX(), rectF.centerY(), (rectF.height() / 2), Path.Direction.CW); | |
} | |
canvas.clipPath(clipPath); | |
super.onDraw(canvas); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment