mapView的xml
<view android:id="@+id/mv"
[color=blue] class="com.google.android.maps.MapView"[/color]
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
[color=blue]android:apiKey="0yxPVuoWg4JGeXCpA3WaJCnbiR2lLfCC_yCTqfA" [/color]
/>
mapController = mapView.getController();
map控制器似乎是控制地图移动的,缩放和中心位置都通过他设定
放大: mapController.zoomIn();
缩小: mapController.zoomOut();
向北: GeoPoint point = new GeoPoint(mapView.getMapCenter()
.getLatitudeE6()
+ mapView.getLatitudeSpan() / 4, mapView.getMapCenter()
.getLongitudeE6());
mapController.setCenter(point);
[color=olive]=================小贴士===================================[/color]
如果只是想把点放到地图上,而不是让map以点为中心显示,做法是
mapController.animateTo(point);//激活就可以了
mapController.setCenter(point);//激活并放到视图中间
东南西北都是在经度和纬度上改变下
设置街景视图: mapView.setSatellite(false);
mapView.setStreetView(true);
mapView.setTraffic(false);
街景,交通,卫星三个视图类似
<view android:id="@+id/mv"
[color=blue] class="com.google.android.maps.MapView"[/color]
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
[color=blue]android:apiKey="0yxPVuoWg4JGeXCpA3WaJCnbiR2lLfCC_yCTqfA" [/color]
/>
mapController = mapView.getController();
map控制器似乎是控制地图移动的,缩放和中心位置都通过他设定
放大: mapController.zoomIn();
缩小: mapController.zoomOut();
向北: GeoPoint point = new GeoPoint(mapView.getMapCenter()
.getLatitudeE6()
+ mapView.getLatitudeSpan() / 4, mapView.getMapCenter()
.getLongitudeE6());
mapController.setCenter(point);
[color=olive]=================小贴士===================================[/color]
如果只是想把点放到地图上,而不是让map以点为中心显示,做法是
mapController.animateTo(point);//激活就可以了
mapController.setCenter(point);//激活并放到视图中间
东南西北都是在经度和纬度上改变下
设置街景视图: mapView.setSatellite(false);
mapView.setStreetView(true);
mapView.setTraffic(false);
街景,交通,卫星三个视图类似