我尝试了[与2 Lat Long详细信息]
final LatLng latlong = new LatLng(lat,lng);
final LatLng latlongcr = new LatLng(currentlat,currentlong);
mapView.addMarker(new MarkerOptions().position(latlongcr).title("Here You Are"));
mapView.addMarker(new MarkerOptions().position(latlong).title(addr));
mapView.moveCamera(CameraUpdateFactory.newLatLngZoom(latlong, 20));
mapView.moveCamera(CameraUpdateFactory.newLatLngZoom(latlongcr, 20));
mapView.animateCamera(CameraUpdateFactory.zoomTo(20), 2000, null);
但只获得一个标记。想要显示2个标记Mapview正常工作
答案 0 :(得分:3)
尝试使用LatLngBounds.Builder
:
LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(latlongcr);
builder.include(latlong);
LatLngBounds bounds = builder.build();
mapView.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 20));