更改OSMDroid的MyLocationOverlay标记 [英] Changing OSMDroid's MyLocationOverlay marker

查看:814
本文介绍了更改OSMDroid的MyLocationOverlay标记的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变标记在MyLocationOverlay。什么到目前为止,我已经试过被继承OSMDroid的MyLocationOverlay并覆盖默认的标记点,使用这个答案提供code 。然而,它并没有正常工作(我得到了错误:方法drawMyLocation必须覆盖或实现超方法的评论,但 @覆盖解决它) 。

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).

不过,标记的图像保持不变(询问谷歌地图API的问题,而我使用OSMDroid) - 我该如何解决呢?

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

推荐答案

您在这里有几个选项。首先,我建议你在使用osmdroid MyLocationNewOverlay。原来MyLocationOverlay已经去precated。然后,您可以

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. 创建你自己的ResourceProxy,提供自定义bitmap.person资源。

  2. 创建一个子类,并修改mPersonBitmap和可选的mPersonH​​otspot,以确保您的自定义图像正确对齐。

  3. 您正在寻找替代按链接的答案的方法签名是:

  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)


这篇关于更改OSMDroid的MyLocationOverlay标记的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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