我正在使用 Groupie Adapter 将我的数据填充到 RecylerView,其中包含不同类型的项目并使用可扩展的组和部分,其中一个项目是 Horizontal RecyclerView - 一切正常,除了 ** 我无法将子 Horizontal RecyclerView 滚动到查看它的项目。**
var uiList = mutableListOf<Group>()
private val adapter = GroupAdapter<GroupieViewHolder>()
......
val horizontalListItem = PiHorizontalListItem(
mediaIdCounter++,
horizontalAdapter,
nestedSharedViewPool
)
expandableGroup.add(
horizontalListItem
)
.....
uiList.plusAssign(expandableGroup)
adapter.addAll(uiList)
mainRecyclerView.adapter = adapter
PiHorizontalListItem 包含一个 RecyclerView
class PiHorizontalListItem(
private val id: Long,
private val carouselAdapter: GroupAdapter<GroupieViewHolder>,
private val sharedPool: RecyclerView.RecycledViewPool
) :Item() {
override fun getId(): Long = id
override fun getLayout(): Int = R.layout.item_horizontal_rv
override fun bind(viewHolder: GroupieViewHolder, position: Int) {
viewHolder.containerView.rv.apply {
setRecycledViewPool(sharedPool)
(layoutManager as LinearLayoutManager).orientation = LinearLayoutManager.HORIZONTAL
(layoutManager as LinearLayoutManager).recycleChildrenOnDetach = true
adapter = carouselAdapter
setHasFixedSize(true)
}
}
}
任何人都可以帮我解决这个问题,或者是否有解决方法?