[英]how to set recyclerview adapter in fragment in kotlin
The below error is displayed.显示以下错误。
I'm trying to set the adapter on onViewCreated Lifecycle method in Fragment.我正在尝试在 Fragment 的 onViewCreated Lifecycle 方法上设置适配器。
Try using image_recyclerview.adapter = picture_adapter(infos, this, this)尝试使用 image_recyclerview.adapter = picture_adapter(infos, this, this)
In kotlin you don't have to use 'setAdapter' but instead you can just use adapter.在 kotlin 中,您不必使用“setAdapter”,而是可以只使用适配器。 When trying to do this remember that it's not a function invocation.
尝试执行此操作时请记住,这不是函数调用。 Instead you can use it like this:
相反,您可以这样使用它:
imageRecyclerView.adapter = picture_Adapter(infos, this, this)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.