如何在Google Maps for Android API v2上显示我的位置 [英] How to display my location on Google Maps for Android API v2

查看:143
本文介绍了如何在Google Maps for Android API v2上显示我的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于这个问题的回答,我看上去很高,也没有人在任何论坛问题上提供帮助。我已经通过教程进行了搜索。 API指南说:

I've looked high and low for an answer on this, and no one, in any forum question has been able to help. I've searched through the tutorials. The API Guide says:


只有在启用我的位置图层后,我的位置按钮才会出现在屏幕
的右上角。

The My Location button appears in the top right corner of the screen only when the My Location layer is enabled.

所以我一直在寻找这个我的位置图层,并一直无法找到任何东西。如何在Google Map上显示我的位置?

So I've been looking for this My Location layer and have been unable to find anything. How do I show my location on a Google Map?

推荐答案

API指南有一切错误(真的是Google?)。使用Maps v2,您无需启用图层即可展示自己,只需调用您使用地图创建的GoogleMaps实例即可。

The API Guide has it all wrong (really Google?). With Maps v2 you do not need to enable a layer to show yourself, there is a simple call to the GoogleMaps instance you created with your map.

Google文档

Google提供的实际文档为您提供了答案。 Call

The actual documentation that Google provides gives you your answer. Call

// map is a GoogleMap object
map.setMyLocationEnabled(true);

并观看奇迹发生。

这篇关于如何在Google Maps for Android API v2上显示我的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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