I am working on a custom view in which items can be expanded and collapsed on action tap. So i have taken a horizontal recyclerview having another horizontal recyclerview in its item. But i am facing a problem with this implementation Outer adapter is binding view holder for only items which are visible on screen, which is as expected, but inner adapter is calling onBindViewHolder function for all items present in list. I set adapter in inner recycler view like this
val layoutManager = LinearLayoutManager(effectRecyclerView.context,LinearLayoutManager.HORIZONTAL, false)
innerAdapter = InnerItemAdapter(innerItemList, clickListener)
innerRecyclerView.isNestedScrollingEnabled = false
innerRecyclerView.adapter = innerAdapter
innerRecyclerView.itemAnimator = null
innerRecyclerView.layoutManager = layoutManager
innerRecyclerView.setRecycledViewPool(viewPool)
This is implemented in onBindViewHolder of outer adapter.