简体   繁体   中英

Google maps in android should be zoomable but not scrollable

I have implemented a MapView in android. I need to achieve following things in maps

  1. Maps should not be scrollable (Achieved using setClickable() to false)
  2. Maps should not be scrollable (as setClickable is false, Map is not zoomable)

Enable the zoom gestures on your map object and disable the scroll gestures:

@Override
public void onMapReady(final GoogleMap googleMap) {
    googleMap.getUiSettings().setZoomGesturesEnabled(true);
    googleMap.getUiSettings().setScrollGesturesEnabled(false);
}

您可以使用以下方法禁用MapFragment滚动:

googleMap.getUiSettings().setScrollGesturesEnabled(false);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM