Android:如果标记在地图上彼此重叠,则会为最后一个隐藏的事件触发点击事件 [英] Android : If markers are overlapping each other on the map, then the click event is fired for the last hidden one
问题描述
在我们的应用程序中,很多标记都绘制在不同的位置,并且在某些情况下以特定的缩放级别绘制,标记相互重叠。因此,当我点击标记时,我预计顶部标记的 onMarkerClick
被触发,但是它会被触发为最后一个隐藏标记,即最后一个隐藏标记标记,它后面没有标记。
你建议我做什么?另外,我没有信息窗口,因此我从 onMarkerClick
方法返回 true
。
我在这里找到了解决方案: https://github.com/googlemaps/android-maps-utils/issues/26
<$ p $ b $ lt; code> mGoogleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter()
{
@Override
public View getInfoWindow(Marker marker)
{
//空信息窗口
return new View(getApplicationContext());
}
@Override
public View getInfoContents(Marker marker)
{
返回null;
}
});
In our application, a lot of markers are drawn in different locations and in certain cases at a certain zoom level, markers overlap each other. So when I click on the marker, I expect the top marker's onMarkerClick
to be fired but instead it is fired for the last hidden marker i-e the last marker, with no markers behind it.
What do you suggest I do? Also, I have no info windows, therefore I return true
from onMarkerClick
method.
I found the solution here: https://github.com/googlemaps/android-maps-utils/issues/26
mGoogleMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter()
{
@Override
public View getInfoWindow(Marker marker)
{
// Empty info window.
return new View(getApplicationContext());
}
@Override
public View getInfoContents(Marker marker)
{
return null;
}
});
这篇关于Android:如果标记在地图上彼此重叠,则会为最后一个隐藏的事件触发点击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!