简体   繁体   English

Android MapBox 标记偏移

[英]Android MapBox marker offset

I have to set marker offset to bottom (center is by default).我必须将标记偏移设置为底部(默认为中心)。 I found how to do it on JS or iOS, but how to do it in Android?我找到了如何在 JS 或 iOS 上执行此操作,但如何在 Android 中执行此操作?

JS - http://bl.ocks.org/andrewharvey/01006319700c5352deaad3b58ec53b8c JS - http://bl.ocks.org/andrewharvey/01006319700c5352deaad3b58ec53b8c

iOS - MapBox marker offset iOS - MapBox 标记偏移

There is a property called Anchor for marker based on their Doc有一个名为 Anchor 的属性用于基于他们的Doc 的标记

I haven't used it yet, but you should be able to do:我还没有使用它,但你应该能够做到:

new MarkerViewOptions().anchor(0.5f, 1.0f)

Hope this helps:)希望这有帮助:)


EDIT (28Dec2017)编辑(2017 年 12 月 28 日)

Mapbox sdk v5.2.0 deprecates MarkerView , users are advised to leverage SymbolLayer instead. Mapbox sdk v5.2.0 弃用MarkerView ,建议用户SymbolLayer Please refer to https://github.com/mapbox/mapbox-gl-native/pull/9782请参考https://github.com/mapbox/mapbox-gl-native/pull/9782

i find the following centres the marker我发现以下中心标记

new SymbolLayer(<layer-id>,<source-id>)
  .withProperties(
    ...
    iconOffset(new Float[]{0f, 12.5f})
    ...
   ));

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

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