How can I identify that RecyclerView's last item is visible on screen?

前端 未结 5 1892
自闭症患者
自闭症患者 2021-01-31 19:18

I have one RecyclerView and I added list of data into the RecyclerView. I wanted to add more data in list, when last RecyclerView item is

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-31 20:02

    @Override
    public void onBindViewHolder(final RecyclerView.ViewHolderholder, int position) {
    
        if (!list.isEmpty() || list== null) {
    
            if (position == (list.size() - 1)) {
    
                // add new data (add data to list)
                this.notifyDataSetChanged();
    
            }
    
        }
    
    
    }
    

提交回复
热议问题