Changing OSMDroid's MyLocationOverlay marker

≡放荡痞女 提交于 2020-02-25 08:47:06

问题


I want to change the marker in the MyLocationOverlay. What I've tried so far is subclassing OSMDroid's MyLocationOverlay and overriding the default marker, using code provided in this answer. However, it didn't work properly (I got the error: method drawMyLocation must override or implement a supertype method but commenting @Override solved it).

However, the marker image stays the same (the question asked about Google Maps API, whereas I'm using OSMDroid) - how can I solve it?


回答1:


You have a few options here. First, let me suggest you use MyLocationNewOverlay in osmdroid. The original MyLocationOverlay has been deprecated. You then can

  1. Create your own ResourceProxy that provides your custom bitmap.person resource.
  2. Create a subclass and modify the mPersonBitmap and optionally the mPersonHotspot to make sure your custom image is aligned properly.
  3. The method signature you are looking to override as per the linked answer is:

    protected void drawMyLocation(final ISafeCanvas canvas, final MapView mapView, final Location lastFix)
    


来源:https://stackoverflow.com/questions/18615849/changing-osmdroids-mylocationoverlay-marker

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