我正在尝试在Kotlin中进行Recyclerview的多项选择,我可以使用一个适配器,但是不能使用两个或多个适配器。
class MyItemDetailsLookup(private val recyclerView: RecyclerView) :
ItemDetailsLookup<Long>() {
override fun getItemDetails(event: MotionEvent): ItemDetails<Long>? {
val view = recyclerView.findChildViewUnder(event.x, event.y)
if (view != null) {
val selectedItems = (recyclerView.getChildViewHolder(view) as ListaProdutosAdapter.MyViewHolder ) // here is my problem i need to make as "x adapter" i only can do for one adaper
.getItemDetails()
return selectedItems
}
return null
}
}
我认为最好的解决方案是将适配器作为参数传递,因此我不能在一个函数中使用倍数适配器。如果您还有其他解决方案,请告诉我