【问题标题】:how to set marker in center of the circle如何在圆心设置标记
【发布时间】:2019-01-16 14:52:40
【问题描述】:

我尝试在 MapView 的圆心设置标记,我使用地图和圆的相同坐标,但标记的图像没有集中这是代码:

<MapView
                    ref={(ref) => this.map = ref}
                    provider={MapView.PROVIDER_GOOGLE}
                    style={styles.map}
                    region={{
                        latitude: this.props.user.pos.lat,
                        longitude: this.props.user.pos.lng,
                        latitudeDelta: 0.015,
                        longitudeDelta: 0.0121,
                    }}>

                    <MapView.Circle
                        center={{latitude: 33.941582,
                            longitude: 10.066695, }}
                        radius={1000}
                        fillColor="#fed42855"
                        strokeColor="#fed42855" >

                        </MapView.Circle>
                        <MapView.Marker
                        coordinate={{
                            latitude: 33.941582,
                            longitude: 10.066695,
                        }}
                        title={"title"}
                        description={"description"}                          

            image{require('../../../../../assets/navigation.png')}

                    /> 

                </MapView>

【问题讨论】:

    标签: react-native android-mapview


    【解决方案1】:

    MapView 标记显示在给定坐标的正上方,因为默认情况下标记显示为大头针,大头针的底部对应于坐标。

    您可以使用anchorcenterOffset 道具根据您的需要重新定位标记。你可以找到documentation here

    【讨论】:

      猜你喜欢
      • 2015-04-16
      • 2016-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-23
      相关资源
      最近更新 更多