Rounded border in Xamarin.Forms.Entry keeps getting cut

My rounded border entry is getting cut out. The code in my custom renderer makes the rounded corners have larger widths than my set border width. How do I remove the increased border width on the corners?

Screenshot of entry Code:

var y = (float)CalculateResolutionScaling(25);
var x = new float[] { y, y, y, y, y, y, y, y };
var z = new RectF(35, 35, 35, 35);
var shape = new ShapeDrawable(new global::Android.Graphics.Drawables.Shapes.RoundRectShape(x, null, null));
shape.Paint.StrokeWidth = (float)CalculateResolutionScaling(control.BorderWidth * 2.75);
Control.Background = shape;
shape.Paint.Color = control.BorderColor.ToAndroid();

2 answers

  • answered 2018-11-14 06:04 G.hakim

    All you have to do is add this to your styles:


    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="" >
    <corners android:radius="10dp" />
        android:top="3dp" />
        android:startColor="@color/White" />
        android:color="@color/Gray" />

    Then use it something like this:

     Control.Background = ResourcesCompat.GetDrawable(this.Resources, Resource.Style.RoundedCorner, null);

    In case you want to change the colour of the Corner just change the stroke colour in the XML above.

    If you have any queries feel free to revert.

  • answered 2018-11-14 10:03 Nitin Malik

    we can achieve rounded corner entry in xamarin.forms without a custom render. you can use a Frame to create rounded corner effect.