Android 地图 将地图叠加层固定到坐标
大家好,我正在为大学编写一些代码,到目前为止,我已经创建了一个简单的谷歌地图,具有前往用户位置、放大和缩小的功能。我想在地图上的特定位置上放置一个简单的地图绘图。 我做了很多研究,但似乎找不到正确的方法。我尝试将位置的坐标转换为像素并将其作为位图放置在这里。图像不会停留在我放置的位置。 我想做的基本上是将此图像固定到特定位置,当用户放大和缩小时,图像应该收缩和拉伸,基本上保持固定到确切位置。 我似乎也无法计算出 drawBitmap() 方法,我想要四个位置, x, y, x-(image.width), y-(image.heigth) 正确定位图像。
任何帮助将不胜感激,因为我不是最强的代码并且束手无策。
Hi Im working on some code for college and I have thus far created a simple Google Map with the function of going to the users location, zooming in and out. I want to place a simple map drawing over a specific location on my map.
I have done so much research but cannot seem to find the right way to do it. I tried to convert the coordinates of the location to pixels and place it here as a bitmap. The image won't stay where I position it.
What I want to do basically is pin this image to the specific location and as the user zooms in and out, the image should shrink and stretch, essentially staying pinned to the exact location.
I also can't seem to work out the drawBitmap() method, I want to have four positions,
x, y, x-(image.width), y-(image.heigth) to position the image correctly.
Any help would be greatly appreciated as I'm not the strongest code and at my wits end.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个图书馆应该可以帮助你。包含起来相当容易。
https://github.com/jgilfelt/android-mapviewballoons
This library should help you out. It is fairly easy to include.
https://github.com/jgilfelt/android-mapviewballoons