Question

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?

Was it helpful?

Solution

try this inside your xml layout

    android:background="@android:color/transparent"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top