I have a recyclerview inside another recycler view, but when I apply the method to the parent to go to a certain child, some recyclerview of those children are not seen, but the rest of the child is seen. The internal recyclerview is as follows.
val layout = GridLayoutManager(itemView.context, 2)
layout.recycleChildrenOnDetach = true
layoutManager = layout
val mAdapter = Adapter(onChildItemClick)
adapter = mAdapter
mAdapter.oldList = datesModelObject.list
isNestedScrollingEnabled = false
setHasFixedSize(true)
setRecycledViewPool(RecyclerView.RecycledViewPool())
CodePudding user response:
From official docs:
Recycled view pools allow multiple RecyclerViews to share a common pool of scrap views. This can be useful if you have multiple RecyclerViews with adapters that use the same view types, for example if you have several data sets with the same kinds of item views displayed by a ViewPager.
By default, 5 ViewHolder
s are retained in the pool for a particular viewType. If you want to change that count, it may be done this way:
recyclerView.getRecycledViewPool()
.setMaxRecycledViews(SOME_VIEW_TYPE, POOL_CAPACITY);
CodePudding user response:
I just removed
layout.recycleChildrenOnDetach = true
and work perfectly