Keep map centered regardless of where you pinch zoom on android

前端 未结 5 783
谎友^
谎友^ 2020-12-01 11:10

I\'m looking to do something similar to the way Uber handles pinch zoom events. No matter where you pinch on the screen, it keeps the map centered and zooms in on the center

5条回答
  •  醉话见心
    2020-12-01 12:05

    Personally, I would disable only zoom gestures on the map, detect pinch on an overlay, and then pass everything else through to the map.

    The google-maps v2 API doesn't have anything explicit for custom zoom handling. Although I'm sure you could inject something, doing the overlay approach insulates you from google-maps changes, and lets you more easily support other map providers if needed.

    (Just for completeness: you could also handle the post-camera change events and re-center, but that would be a janky, bad user experience.)

提交回复
热议问题