在Android Google Maps API v2中隐藏标记信息窗口 [英] Hide markers info window in android google maps API v2

查看:94
本文介绍了在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.

这篇关于在Android Google Maps API v2中隐藏标记信息窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆