2013-03-11 98 views
0

下午好,MapView的开始位置

当我开始我的应用程序,的MapView是呈像您可以在后续的图片中看到:

enter image description here

,但我想启动在某些时候某些变焦MapView类,类似这样:

enter image description here

其中实现方法具我需要使用?

在此先感谢。

回答

3

您缩放级别添加到地图控制器:

mapView.getController().setZoom(17); // an int that suits you 

了解更多关于缩放级别的位置:https://developers.google.com/maps/documentation/staticmaps/#Zoomlevels

要设置中心,您可以使用:

mapView.getController().setCenter(new GeoPoint(latitude,longitude)); 
+0

感谢您的信息,我怎么能确定这个int? 编辑:我的意思是,我想改变正在缩放的​​geoPos。例如,现在在美国的某个地方,我想在埃及。 – unpix 2013-03-11 15:40:19

+0

请查看:https://developers.google.com/maps/documentation/staticmaps/#Zoomlevels我通常首先在谷歌地图上尝试:) – span 2013-03-11 16:00:08

+0

您可以使用:mapView.getController()。setCenter(新的GeoPoint(纬度,经度)); – span 2013-03-11 16:02:10

0

集 -

mapView.setStreetView(true); 
0
mapView.getController().setZoom(17); // an int that suits you 
mapView.getController().setCenter(new GeoPoint(latitude,longitude)); 

这是解决方案。

0

显示埃及使用它 -

String coordinates[] = {"18.352566007", "73.78921587"};//here you can set geopoints of egypt 
    double lat = Double.parseDouble(coordinates[0]); 
    double lng = Double.parseDouble(coordinates[1]); 

    p = new GeoPoint(
     (int) (lat * 1E6), 
     (int) (lng * 1E6));//p is GeoPoint 

    mc.animateTo(p); 
    mc.setZoom(17); 
    mapView.invalidate();