作为标题,我可以使用地图v1
mapController.zoomToSpan(..., ..., ...);
Run Code Online (Sandbox Code Playgroud)
在屏幕上包含所有标记.
剂量图V2有相同的方法吗?
2013/2/22编辑:
首先,获取您想要在屏幕上涉及的所有LatLng点.
假设您有3个LatLng点,请使用
LatLngBounds bounds = new LatLngBounds.Builder().include(point1)
.include(point2).include(point3).build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 50));
Run Code Online (Sandbox Code Playgroud)
我希望这对你有用。
public class GoogleMapActivity extends FragmentActivity {
private GoogleMap map;
Bundle extras;
LatLng latlng;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.google);
extras = getIntent().getExtras();
if (extras != null) {
unit_long = extras.getString("unit_long");
unit_lat = extras.getString("unit_lat");
}
latlng = new LatLng(Double.parseDouble("19.25252"),
Double.parseDouble("23.25252525"));
map = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
Marker hamburg = map.addMarker(new MarkerOptions().position(latlng)
.title("Location").snippet("I am here")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.marker)));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(latlng, 15));
// Zoom in, animating the camera.use this line in your code
map.animateCamera(CameraUpdateFactory.zoomTo(14), 2000, null);
// map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2902 次 |
| 最近记录: |