我的位置按钮事件监听器 [英] My location button event listener
问题描述
我启用了谷歌地图Android的API第2版,它增加了浮动按钮,进入用户的当前位置的我的定位层。我需要一种方法来检测该按钮的点击。这可能吗?
I enabled the my-location layer of the Google Maps Android API v2, which adds the floating button to go to the user's current location. I need a way to detect a click on this button. Is this possible?
推荐答案
没有,目前还没有办法得到这些信息。有上调的功能请求,并已经确认的由谷歌。
No, currently there is no way to get that information. There is a feature request raised for that and it is already Acknowledged by Google.
星,如果你想更快的修复:
Star it if you want a quicker fix:
<一个href="http://$c$c.google.com/p/gmaps-api-issues/issues/detail?id=4789&q=apitype%3DAndroid2&colspec=ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Stars%20ApiType%20Internal">http://$c$c.google.com/p/gmaps-api-issues/issues/detail?id=4789&q=apitype%3DAndroid2&colspec=ID%20Type%20Status%20Introduced%20Fixed%20Summary%20Stars%20ApiType%20Internal
解决方法:
禁用内置的控制和创建自己的视图,并将其添加到屏幕上。设置onClickListener到该按钮,动画地图,地图上的位置。
Disable the built-in control and create your own View and add it to the screen. Set an onClickListener to this button and animate the map to the map's location.
禁用默认控件:
UiSettings.setMyLocationButtonEnabled(false)
从地图上获取我的位置:
Get my location from the map:
GoogleMap.getMyLocation()
这篇关于我的位置按钮事件监听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!