【发布时间】:2016-12-05 10:47:07
【问题描述】:
我必须将标记偏移设置为底部(默认情况下为中心)。我找到了如何在 JS 或 iOS 上做到这一点,但是如何在 Android 中做到呢?
JS - http://bl.ocks.org/andrewharvey/01006319700c5352deaad3b58ec53b8c
iOS - MapBox marker offset
【问题讨论】:
我必须将标记偏移设置为底部(默认情况下为中心)。我找到了如何在 JS 或 iOS 上做到这一点,但是如何在 Android 中做到呢?
JS - http://bl.ocks.org/andrewharvey/01006319700c5352deaad3b58ec53b8c
iOS - MapBox marker offset
【问题讨论】:
有一个基于Doc的标记的属性称为Anchor
我还没用过,但你应该可以:
new MarkerViewOptions().anchor(0.5f, 1.0f)
希望这会有所帮助:)
编辑(2017 年 12 月 28 日)
Mapbox sdk v5.2.0 弃用了MarkerView,建议用户改用SymbolLayer。
请参考https://github.com/mapbox/mapbox-gl-native/pull/9782
【讨论】:
我发现以下标记居中
new SymbolLayer(<layer-id>,<source-id>)
.withProperties(
...
iconOffset(new Float[]{0f, 12.5f})
...
));
【讨论】: