问题描述
我试图触发标志点击(或其他地图事件太)在编程为Android V2谷歌地图API。没有人有一个想法,怎么办呢?
I am trying to trigger a marker click (or other map events too) programmatically in Google maps API for android V2. Does anyone have an idea as to how to do it ?
显然的JavaScript API(V3),具有触发功能,但我could'nt发现任何东西的机器人。
Apparently javascript api (v3) , has a trigger function but I could'nt find anything for android.
感谢您的帮助。
推荐答案
您不能TRIGER标记直接点击。
You cannot triger a marker click directly.
如果你需要运行默认的实现时onMarkerClick返回false(或者你有没有OnMarkerClickListener),你需要自己做:
If you need to run default implementation when onMarkerClick returns false (or you have no OnMarkerClickListener), you need to do it yourself:
marker.showInfoWindow();
map.animateCamera(CameraUpdateFactory.newLatLng(marker.getPosition()), 250, null);
250这里假设,API不给你在内部使用这个默认标记点击行为的价值。
250 is assumed here, API doesn't give you the value used internally for this default marker click behaviour.
如果你有一个OnMarkerClickListener,你可以只保留参考,并调用一个函数就可以发送标记为一个参数。
If you have a OnMarkerClickListener, you can just keep the reference and call a function on it sending marker as a param.
这篇关于触发一个事件的地图(如标志点击)在谷歌地图Android的V2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!