Android 开发 - 使用 PNG 作为地图,标记当前位置
我有一个大的 PNG(大约 1500 x 2000),将其切成切片并使用 HTML 重新组合在一起,否则图像质量很糟糕。 我希望能够在此图像上标记用户当前位置。我有点不知道如何做到这一点,特别是如果图像是可缩放的。 例如:如何使标记在字符串上具有可变位置? (按代码) 我如何知道放大时坐标要改变多少? 帮助或代码示例将不胜感激!我很困惑。 谢谢!
注意:请具体一点,我承认我没有android开发经验
I have a large PNG (around 1500 x 2000) that cut into slices and put back together using HTML because otherwise the image quality is horrible.
I want to be able to have a marker of the user's current location on this image. I'm a little lost about how to do this, especially if the image is zoomable.
Ex: How do I make the marker have variable location on the string? (codewise)
How do I know how much to change the coordinates by when they zoom in?
Help or code samples would be highly appreciated! I am very stuck.
Thanks!
Note: Please be specific, I admit I am not experienced at android development
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不直接将标记位置存储在原始图像坐标(x,y)上?例如。如果用户位于中间,则将其位置保存为 (750, 1000)。当你放大时,一切都是相对的;因此,如果放大到 2 倍,完整图像将为 3000x4000,标记位置将为 (1500, 2000)。
我不明白你的困难是什么:)也许我低估了问题所在。
Why not just store the marker position on the original image coordinates (x, y)? eg. if the user is in the middle, save their position as (750, 1000). When you zoom, everything is relative; so if you zoom to 2x, the full image would be 3000x4000, and the marker position would be (1500, 2000).
I don't see what your difficulty is :) maybe I'm underestimating what the problem is.