Created
July 25, 2018 08:41
-
-
Save Axemasta/4d21cb363bed0482dbdc636abda7cc3a to your computer and use it in GitHub Desktop.
Xamarin Android Corner Radius
This file contains 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
protected override bool DrawChild(Canvas canvas, Android.Views.View child, long drawingTime) | |
{ | |
float cornerRadius = child.Height / 2; | |
var path = new Path(); | |
path.AddRoundRect(new RectF(0, 0, child.Width, child.Height), cornerRadius, cornerRadius, Path.Direction.Cw); | |
canvas.ClipPath(path); | |
return base.DrawChild(canvas, child, drawingTime); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment