Google地图标记可点击区域 [英] Google Map Marker Clickable Area

查看:173
本文介绍了Google地图标记可点击区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用此示例: https://github.com/galex/android-mapviewballoons



我的问题是可点击区域比标记本身更宽。例如,我的Google地图标记是25x25,那么可点击区域最多可以扩展到70x70。这是重叠标记的一个大问题。



当我点击该箭头的尖端时,即使点击区域远离标记,onTap也会被激活。

请帮助我。谢谢。

解决方案

这是 ItemizedOverlay 的默认行为。对于大多数人的手指来说,25x25 px通常不是一个足够的可触摸区域。



您应该重写 hitTest()方法如果你想修改重叠项目命中的方式进行测试。


I am using this example: https://github.com/galex/android-mapviewballoons

My problem is that the clickable area is wider than the marker itself. For example, my Google Map marker is 25x25 then the clickable area would extend up to 70x70. This is a big problem for overlapping markers.

When I clicked on the tip of that arrow, onTap is activated, even though the tap area is far from the marker.

Please help me. Thanks.

解决方案

This is the default behaivior of ItemizedOverlay. 25x25 px is generally not an adquate touchable area for most human fingers.

You should override the hitTest() method if you want to modify the way an overlay item hit is tested.

这篇关于Google地图标记可点击区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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