Take the 2-minute tour ×

I am developing a Android Cell phone application using MonoDevelop for Android and the MapsAndLocationDemo. I am wanting to display some text under each overlay item. I have overridden the Draw method to do this.

Here is my code:

        public override void Draw (Android.Graphics.Canvas canvas, MapView mapView, bool shadow)
            base.Draw (canvas, mapView, shadow);

            var paint = new Paint ();
            paint.AntiAlias = true;

            var gp = overlayDetailsForThisOverlay.overlayGeoPoint;
            var pt = mapView.Projection.ToPixels (gp, null);     

            canvas.DrawRect (pt.X, pt.Y, pt.X + 50, pt.Y + 50, paint);
            canvas.DrawText("Test", pt.X, pt.Y, paint);

I am only wanting to display the text. However, if I remove the canvas.DrawRect line of code, no text is displayed at all.

Can I please have some help to display some desired text under an overlay item without having a rectangle drawn at all?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

try this inside your xml layout

share|improve this answer

Your Answer


