[英]Kotlin with Map ( Marker Not showing)
Hello I'm trying to implements Google Maps
in kotlin, but in these code my getMapAsync
is not getting called, the maps shows perfectly but the marker doesn't show up 您好我正在尝试在kotlin中实现Google Maps
,但是在这些代码中我的getMapAsync
没有被调用,地图显示完美但标记没有显示
var mapFragment : SupportMapFragment?=null
mapFragment= fragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
mapFragment?.getMapAsync {
val sydney = LatLng(22.30, 73.20)
mMap!!.addMarker(MarkerOptions().position(sydney).title("Marker in Sydney"))
mMap!!.moveCamera(CameraUpdateFactory.newLatLng(sydney))
Toast.makeText(activity,"dfgdg",Toast.LENGTH_LONG).show() }
-33.8479731,150.6517908
Sydney lat lng是-33.8479731,150.6517908
mapFragment?.getMapAsync { map -> // <- this is the map that you got async not mMap val sydney = LatLng(-33.8479731, 150.6517908) map.addMarker(... map.moveCamera(... }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.