I have done it. By default, the controls go to the bottom of the map, and I wanted it to be the top of the map. I used this.
<com.google.android.maps.MapView android:layout_below="@+id/layout_zoom" android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey="key" /> <ZoomControls android:id="@+id/zoomControls" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></ZoomControls>
then the MapActivity class has zoom controls
MapView mp = (MapView) findViewById(R.id.mapview); ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomControls); zoomControls .setOnZoomInClickListener(new ZoomControls.OnClickListener() { public void onClick(View v) { mp.getController().zoomIn(); } }); zoomControls .setOnZoomOutClickListener(new ZoomControls.OnClickListener() { public void onClick(View v) { mp.getController().zoomOut(); } });
You can also configure these listeners to your own button. hope this helps.
source share