如何在 OSMap 上添加 setMyLocationEnabled 按钮? [英] How to add a setMyLocationEnabled button on OSMap?

查看:54
本文介绍了如何在 OSMap 上添加 setMyLocationEnabled 按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们能否像 GoogleMap 上的 mMap.setMyLocationEnabled(true); 一样在 OSMDroid 上启用GotoMyLocation"按钮?

Can we enable a 'GotoMyLocation' button on OSMDroid like mMap.setMyLocationEnabled(true); on GoogleMap?

我在 MapView 类中没有找到这样的功能.

I didn't find such feature in MapView class.

推荐答案

创建其中一个

org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay mylocation = new MyLocationNewOverlay(...);

将其添加到您的 MapView

Add it to your MapView

mMapView.getOverlays().add(mylocation);

那就试试mylocation.enableFollowLocation();

这篇关于如何在 OSMap 上添加 setMyLocationEnabled 按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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