简体   繁体   English

如何在Android中的Google地图上处理当前位置图标上的点击事件

[英]How to handle the click event on current location icon on google maps in android

I am getting an icon shown in the figure on the google Maps. 我在谷歌地图上的图中显示了一个图标。 Now i have the confusion how to show the current location on the maps with marker whenever a user clicks on the current Location icon the google maps. 现在,我感到困惑的是,每当用户单击Google地图的当前位置图标时,如何在标记上显示当前位置。 After placing this code i got the icon on the google maps 放置此代码后,我在Google地图上得到了图标

Map.setMyLocationEnabled(true);

在此处输入图片说明

On the top-right google map is showing the current location icon, Now my confusion is how to handle this event to show my current location on the google maps. 谷歌地图的右上方显示了当前位置图标,现在我的困惑是如何处理此事件以在谷歌地图上显示我的当前位置。

use setOnMyLocationButtonClickListener() and override 使用setOnMyLocationButtonClickListener()并覆盖

@Override
public boolean onMyLocationButtonClick(){
   return false;
}

returning false does the default behavior 返回false做默认行为

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM