在Android Google Maps API v2中隐藏标记信息窗口

问题描述:

目前,我能够使用Android Google Maps API v2在Google地图中查看所有标记.

Currently I was able to view all my markers in Google maps using Android Google maps API v2.

在地图上添加我的标记:

mapView.addMarker
     (new MarkerOptions()
      .position(aUsersLocation).
      icon(BitmapDescriptorFactory.fromBitmap(aUserImage))
      .snippet(My_VALUE_1)
      .title(My_VALUE_2)
     .hideInfoWindow();

我有几个标记,并且为每个标记的代码段和标题分配了几个值(My_VALUE_1和My_VALUE_2).当用户单击标记时,我需要这些唯一值,我将在 onMarkerClick侦听器中收到以下值:

I have several markers and assigned few values (My_VALUE_1 and My_VALUE_2) to each marker's snippet and title. When user clicks a marker, I need these unique value and I will receive these values in onMarkerClick listener as:

        @Override
        public boolean onMarkerClick(Marker theMarker) 
        {
            String aValue1 = theMarker.getSnippet();
            String aValue2 = theMarker.getTitle();
            theMarker.getPosition().latitude...
           ...
            return false;
        }

我的问题是:当我将片段和标题值添加到标记时,当用户单击标记时,将显示infoWindow.

My question is: as I am adding the snippet and title values to the marker, when user clicks the marker, infoWindow is displayed.

我需要隐藏标记的infoWindow.我尝试了 hideInfoWindow ,但它似乎无法正常工作.

I need to hide the marker's infoWindow. I tried with hideInfoWindow, but it seems to be not working.

请提出任何建议.

谢谢.

return true;

onMarkerClick禁用显示信息窗口并以标记为中心的默认行为.

from onMarkerClick to disable default behavior of showing info window and centering on the marker.