问题描述
我想获得 Recycler View Position onMapReady 方法。但似乎没有回调方法。在 Java 中,我可以使用 getAdapterPosition() 做到这一点,但它在 Kotlin 中不起作用。
override fun onMapReady(googleMap: GoogleMap?) {
//val location: Location = locations.get(getAdapterPosition()) // getAdapterPosition not working
println("onMapReady")
val sydney = LatLng(31.5204,74.3587)
googleMap!!.addMarker(MarkerOptions().position(sydney).title("Sydney"))
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney,13.5f));
}
MapView 工作正常,标记也显示在确切位置。但是现在我想从 recyclerview 的位置数组中获取数据。如何使用 kotlin 获取 onMapReady 中的位置。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)