如何更改我的第一个地图活动视图

时间:2011-05-13 12:06:48

标签: android google-maps map

我在我的应用程序中有一个地图活动。当用户首次启动地图活动时,地图会显示Europe.i woulk的概述,例如,当用户拳头活动开始指向希腊时,例如欧洲洞......这可能......?谢谢

1 个答案:

答案 0 :(得分:3)

您可以使用MapController执行此操作:

MapView map = (MapView) findViewById(R.id.mapview);

GeoPoint center = new GeoPoint(myLatitude, myLongitude);

MapController controller = map.getController();
controller.setCenter(center);
controller.setZoom(ZOOM_LEVEL_DEFAULT);

或者如果您想要计算适合某些经度/纬度范围的缩放:

int latitudeSpan = latitude1 - latitude2;
int longitudeSpan = longitude1 - longitude2;
controller.zoomToSpan(latitudeSpan, longitudeSpan);