如何在反应原生地图上添加标记.对于初学者来说,文档不够清晰



如果代码看起来像这样,我们如何在特定区域添加标记?对于初学者来说,文档不够清晰。

<View style={{marginTop:20, width:null, height:200}}>  
<MapView
style={{ flex: 1,width:null, height:200 }}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}
/>   
</View>

如何将其包含在此代码中?

<View style={{marginTop:20, width:null, height:200}}>  
<MapView
style={{ flex: 1,width:null, height:200 }}
initialRegion={{
latitude: 37.78825,
longitude: -122.4324,
latitudeDelta: 0.0922,
longitudeDelta: 0.0421,
}}>
<Marker coordinate={{
latitude: 37.78825,
longitude: -122.4324,}} >
</Marker>
</MapView>
</View>

您只需将标记放在地图视图中并通过 要放置标记的位置的纬度-经

最新更新