Horizontal RecyclerViews inside vertical RecyclerView scrolling jerks

后端 未结 3 1825
醉酒成梦
醉酒成梦 2020-12-30 11:06

I am using a layout in which I used multiple RecyclerViews (Horizontal) as a item view of RecyclerView. The problem is that the vertical scrolling is not as smooth as I am e

3条回答
  •  误落风尘
    2020-12-30 11:42

    I have solved the problem.

    Scrolling performance is much better in this case.

    Do not set adapters to horizontal RecyclerViews in OnBindViewHolder() method of Parent RecyclerView.

    Instead of it set it at very first time when the view is created via onCreateViewHolder() of RecyclerView with empty or null dataList.

    Just replace the new secondary data list with previous null list at onBindViewHolder() and call notifydataSetChanged() to HorizontalAdapetr.

    This is much better than setAdapter() in onBindViewHolder().

提交回复
热议问题