How to draw at the current GPS location on MapView using MyLocationOverlay?

[亡魂溺海] 提交于 2019-12-19 04:57:22

问题


I'm trying to draw a custom gps-location icon. I'm using MapView and have created a class MyLocationArrow that extends MyLocationOverlay.

I override drawMyLocation() and draw a point at 100,100. But this is the coordinates on screen. How do I get the screen-coordinates from the current GPS-location?


回答1:


You can use

android.graphics.Point toPixels(GeoPoint in,
                                android.graphics.Point out)

Converts the given GeoPoint to onscreen pixel coordinates, relative to the top-left of the MapView that provided this Projection.

.



来源:https://stackoverflow.com/questions/4624993/how-to-draw-at-the-current-gps-location-on-mapview-using-mylocationoverlay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!