I am working on a Xamarin.Forms application, In which I have added a custom renderer to set the background of native edit text. Following Code shows error.
var shape = new ShapeDrawable(new Android.Graphics.Drawables.Shapes.RectShape());
The issue is that your application uses the namespace Project.Android
and the type system will think Android.Grapics.Drawables.Shapes.RectShape
belongs in Project.Android
.
You some options:
Android.Graphics.Drawables.Shapes.RectShape
with global::
like: global::Android.Graphics.Drawables.Shapes.RectShape
RectShape
comes from: using RectShape = Android.Graphics.Drawables.Shapes.RectShape
and just use new RectShape()