How to implement load more recyclerview in android

前端 未结 8 1742
盖世英雄少女心
盖世英雄少女心 2020-12-30 06:23

I want to implement load more in Recyclerview. Here is the code. The code is from github. https://gist.github.com/ssinss/e06f12ef66c51252563e

MainActivity code:

相关标签:
8条回答
  • 2020-12-30 06:56

    Try this....

      static boolean loadmore=true;
      LinearLayoutManager layoutManager = ((LinearLayoutManager)recyclerView.getLayoutManager());
       recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
                // super.onScrolled(recyclerView, dx, dy);
                int lastVisiblePosition = layoutManager.findLastVisibleItemPosition();
                if (lastVisiblePosition == recyclerView.getChildCount()) {
                    if (loadmore) {
                        loadmore = false;
                       method();
                    }
                }
            }
        });
    
    
      private void method(){
          loadmore=true;
      }
    
    0 讨论(0)
  • 2020-12-30 06:56

    This links may help you .for load-moreRrecyclerview you need to change. and implement using Link

    or library

    0 讨论(0)
提交回复
热议问题