在 android 中使用 MapView,如何设置默认位置,以便每次加载此应用程序时,它会自动将位置居中/缩放到伦敦?
问问题
14775 次
2 回答
40
首先,获取给定地图的控制器:
MapController myMapController = myMapView.getController();
然后调用:
myMapController.setCenter(new GeoPoint())
这将在给定的 GeoPoint 上设置地图的中心。
有关更多信息,请参阅MapView和MapController的文档
于 2010-08-30T12:00:31.340 回答
1
对于新的 Google Maps API,您需要这样做:
mapFragment.getMapAsync(this::setUpMaps);
在里面setUpMaps(GoogleMap googleMap)
你应该将相机移动到你的默认位置:
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, zoom));
于 2018-11-05T14:29:16.893 回答