Android Map Overlay Disappears on Zoom

后端 未结 2 499
慢半拍i
慢半拍i 2021-01-21 10:14

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... How

相关标签:
2条回答
  • 2021-01-21 10:30

    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.

    0 讨论(0)
  • 2021-01-21 10:45

    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.

    0 讨论(0)
提交回复
热议问题