0
我可以在谷歌地图上显示标记时,他们彼此接近,但当距离很远时,我只能看到一个纬度。基于两种不同坐标的自动缩放mapView
这里是我的代码
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
LatLng google_api_lat_lon = new LatLng(lat, lon);
float zoomLevel = 16.0f;
Marker markerAPILocation = mMap.addMarker(new MarkerOptions().position(google_api_lat_lon).title(title).icon(BitmapDescriptorFactory.fromResource(R.drawable.saved_locaitons)));
markerAPILocation.showInfoWindow();
mMap.setMyLocationEnabled(true);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(google_api_lat_lon, zoomLevel));
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
// mMap.setMyLocationEnabled(true);
mMap.getUiSettings().setMapToolbarEnabled(false);
mMap.getUiSettings().setZoomControlsEnabled(true);
mMap.getUiSettings().setScrollGesturesEnabled(false);
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(google_api_lat_lon, zoomLevel));
}
我需要显示在映射表坐标,只能通过调整基础上的距离缩放级别来实现。我试过上面的代码,但它不适合我。