示例代码:
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(GoogleMap googleMap) {
LatLng newYork = new LatLng(40.73, -73.99);
googleMap.addMarker(new MarkerOptions().position(newYork).title("New York"));
googleMap.moveCamera(CameraUpdateFactory.newLatLng(newYork));
}
});