如何布局变焦控制setBuiltInZoomControls(真)?变焦、布局、setBuiltInZoomControls

2023-09-13 00:32:07 作者:他乡遇古人

想缩放控件添加到地图中。我也想布局的变焦控制,而不是默认的底部中间位置的位置。我可以getZoomControl做到这一点,但它是德precated。

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.

谁能告诉我如何与 setBuildtInZoomControls

推荐答案

这是我得到了我的工作的最后(通过XML布局嵌入ZoomControl)。

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();
        }
});

请参阅:http://stackoverflow.com/questions/920741/always-show-zoom-controls-on-a-mapview