如何在osmdroid中显示当前位置指针?
我想使用 osmdroid 显示当前位置指针。
getController().setCenter(new GeoPoint(location));
此代码不显示指针。那么 osmdroid 是否有像谷歌地图一样内置的东西?
I would like to display the current position pointer using osmdroid.
getController().setCenter(new GeoPoint(location));
This code does not display the pointer. So is there anything built in for osmdroid as it is for google maps?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您需要添加 MyLocationOverlay ,如下所示。
You need to add a MyLocationOverlay somthing like the following.
SetCenter 只会将地图位置设置到特定位置。它不会向中心添加任何指针。您可以使用mapview.addView或mapView的addoverlay。 Osmdroid提供与MapView几乎相同的功能
SetCenter will only set the map position to particular location. It won't add any pointer to the center. You either use mapview.addView or addoverlay of mapView. Osmdroid provides almost same functionality as that of MapView
科特林代码:
kotlin code :