Ad

Always Show Zoom Controls On A MapView

- 1 answer

Is there a way to always show the zoom controls on a MapView? I have added the zoom controls using

map=(MapView)findViewById(R.id.map);
map.setBuiltInZoomControls(true);

but the zoom controls fade in and out. I want them to always be visible.

Ad

Answer

Solved this by putting my own ZoomControls in my layout xml:

<ZoomControls android:id="@+id/zoomcontrols"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

and then setting up onClickListeners for then to handle the zoom:

    zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols);
    zoomControls.setOnZoomInClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mapController.zoomIn();
        }
    });
    zoomControls.setOnZoomOutClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mapController.zoomOut();
        }
    });
Ad
source: stackoverflow.com
Ad