Skip to content

Instantly share code, notes, and snippets.

@Axemasta
Created July 25, 2018 08:41
Show Gist options
  • Save Axemasta/4d21cb363bed0482dbdc636abda7cc3a to your computer and use it in GitHub Desktop.
Save Axemasta/4d21cb363bed0482dbdc636abda7cc3a to your computer and use it in GitHub Desktop.
Xamarin Android Corner Radius
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