kotlinandroid-recyclerviewscrollto

Some elements are not seen in the nested recyclerview after doing smooth scroll to position 0


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())

Solution

  • I just removed

    layout.recycleChildrenOnDetach = true
    

    and work perfectly