2017-01-09 18 views

回答

0

是的,如果您使用不同的latLng变量来为相机设置动画,则可以这样做。

语法:

latLng = new LatLng(double lat, double long); 
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); 
CameraPosition cameraPosition = new CameraPosition.Builder() 
    .target(latLng)    // Sets the center of the map to location user 
    .zoom(15)     // Sets the zoom 
    .build();     // Creates a CameraPosition from the builder 
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); 

如果更改latlong变量的值,相机将聚焦到不同的位置。

设定的值(经度和纬度)可以添加使用getIntent().getSerializableExtra("value")

0

例如使用intent.putExtra("key", value)和牵强的意图群众演员,你可以做这样的事情:

Intent i = new Intent(MyActivity.this, MapActivity.class); 
i.putExtra("latitude", latitude); 
i.putExtra("longitude", longitude); 
startActivity(i); 

然后在onCreate方法您MapActivity类:

double latitude = (Double) this.getIntent().getSerializableExtra("latitude"); 
double longitude = (Double) this.getIntent().getSerializableExtra("longitude"); 

'

相关问题