I have been able to open up a map of the world through code and mark a few places. However, I always have to zoom down to the city, which takes a little while. Is there any way to directly open up a map of a particular city?
问问题
489 次
2 回答
0
例如,您可以将moveCamera与您最后存储的位置(lat、lng 和 zoomLevel)一起使用。
final LatLng location = new LatLng(..., ...);// Loaded from SharedPreferences maybe.
// Move the camera to location with a zoom of 15.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(location, 15));
于 2014-11-23T10:38:27.877 回答
0
您可以使用此示例代码将地图直接设置为您的城市坐标(lat、lng)并自动缩小到指定级别:
// Set desired lat lng location, and zoom level (for example 10)
CameraUpdate cameraUpdate = CameraUpdateFactory.newLatLngZoom(new LatLng(locationCity.getLatitude(), locationCity.getLongitude()), 10);
// Move the camera to location
gMap.animateCamera(cameraUpdate);
于 2014-11-24T07:22:14.757 回答