Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
387 views
in Technique[技术] by (71.8m points)

android - How to layout zoom Control with setBuiltInZoomControls(true)?

would like to add a zoom control to the map. I also want to layout the position of the zoom Control instead of the default middle bottom position. I can do this by getZoomControl but it is deprecated.

Could anyone tell me how to do this with setBuildtInZoomControls?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This is how I got mine working finally (by embedding a ZoomControl in XML layout).

mapView = (MapView) this.findViewById(R.id.mapView);

ZoomControls zoomControls = (ZoomControls) findViewById(R.id.zoomcontrols);
zoomControls.setOnZoomInClickListener(new OnClickListener() {
        public void onClick(View v) {
            mapView.getController().zoomIn();
        }
});
zoomControls.setOnZoomOutClickListener(new OnClickListener() {
        public void onClick(View v) {
            mapView.getController().zoomOut();
        }
});

See: Always show zoom controls on a MapView


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...