点击地图后创建按钮

时间:2012-09-10 10:40:09

标签: android google-maps

我想在点击我的谷歌地图后创建一个按钮,如下所示: enter image description here

我该怎么做?请帮帮我们。

这是显示地图的方法:

public void showMap() {
    View zoomView = mapView.getZoomControls();
    zoomLayout.addView(zoomView, new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    mapView.displayZoomControls(true);
            latitude = 23.765764900000000000;
            longitude = 90.391317200000000000;
    mapController = mapView.getController();
    point = new GeoPoint(
            (int) (latitude*1E6),
            (int) (longitude*1E6));
    mapController.animateTo(point);
    mapController.setZoom(17);
    mapView.invalidate(); }

1 个答案:

答案 0 :(得分:0)

mapview.onTouchListener(this);

然后确保mapactivity实现ontouchlistener。您将能够从触摸事件中获取x和y位置。

然后使用mapview.getProjection()将x和y转换为地理编码坐标。