Get visible items in RecyclerView

前端 未结 9 2108
礼貌的吻别
礼貌的吻别 2020-11-22 07:17

I need to know which elements are currently displayed in my RecyclerView. There is no equivalent to the OnScrollListener.onScroll(...) method on ListViews. I tried to work w

9条回答
  •  梦如初夏
    2020-11-22 07:58

    You can use recyclerView.getChildAt() to get each visible child, and setting some tag convertview.setTag(index) on these view in adapter code will help you to relate it with adapter data.

提交回复
热议问题