简体   繁体   English

Android Map API-更改缩放级别会导致标记位置不正确

[英]Android map api - changing zoom level causes incorrect marker position

Sorry if this was asked before.. it seems so obvious problem but could not find any reference. 抱歉,如果以前有人问过这个问题..看起来很明显,但是找不到任何参考。

When adding marker to the map - not even custom one, just plane marker, and zooming in/out, the marker image "floats" around to different positions, even to different states! 在地图上添加标记时-甚至没有自定义标记,只是平面标记,以及放大/缩小,标记图像都会“浮动”到不同的位置,甚至是不同的状态! I am passing the proper Double to the lat/long etc.. zooming all the way in gets you to the correct place. 我正在将适当的Double传递到经/纬度等位置。一直放大到正确的位置。

Looking at Google's own services such as Google+ location sharing, it seems to work fine for them.. so not sure what to make of it.. are they re-calculating the anchor for each zoom level? 查看Google自己的服务(例如Google+位置共享),似乎对他们来说效果很好。.因此不确定该怎么做..他们是否在重新计算每个缩放级别的锚点? hmm

Appreciate any help! 感谢任何帮助! Thanks, Udi 谢谢,乌迪

I had the same problem adding marker.anchor(0,0); 我在添加marker.anchor(0,0);遇到了同样的问题marker.anchor(0,0); Fixed the problem. 解决了问题。

I have same problem when adding marker to google map, the problem is wrong bitmap when try to convert and resize drawable resource, just use this: 将标记添加到Google地图时,我遇到了同样的问题,当尝试转换和调整可绘制资源的大小时,问题是位图错误,只需使用以下方法:

    Marker marker = mMap.addMarker(new MarkerOptions()
    ...
    .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_merchant_location)));

You could check official Android Docs 您可以检查官方的Android文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM