Skip to content Skip to sidebar Skip to footer

Android Map Overlay Disappears On Zoom

I'm having a headache with Android's Google Maps API... I draw some overlays on the map and it's all fine, it updates regularly and handles gestures well, no problem... However,

Solution 1:

The way I implemented it was using the mapviewballons as library here then using the call to super(boundCenter(defaultMarker), mapView);

The boundCenter keeps the centroid on the screen whose overlay is on screen and on zooming it is unaffected.

Solution 2:

I'd a similar problem, but I was using only squares, which make it easier to solve.

Problem details (at lest with squares):

canvas.drawRect() only draws the rectangle if both top and bottom of rectangle have coordinates within visible screen. As soon as the top or the bottom of the rectangle have a coordinate outside screen, it's not drawn.

Solution I've used for squares

I croped the square to make it always fit within the visible screen coordinates, and it was correctly drawn.

If you are using more complex figures, this solution may be more dificult to implement.

good luck.

Post a Comment for "Android Map Overlay Disappears On Zoom"