http://stackoverflow.com/questions/25178329/recyclerview-and-swiperefreshlayout

write the following code in addOnScrollListener of the RecyclerView

Like this:

        recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener(){
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            int topRowVerticalPosition =
                    (recyclerView == null || recyclerView.getChildCount() == 0) ? 0 : recyclerView.getChildAt(0).getTop();
            swipeRefreshLayout.setEnabled(topRowVerticalPosition >= 0);

        }

        @Override
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
            super.onScrollStateChanged(recyclerView, newState);
        }
    });

相关文章:

  • 2022-03-04
  • 2021-11-02
  • 2021-06-10
  • 2021-05-19
  • 2022-12-23
  • 2021-05-29
  • 2022-12-23
猜你喜欢
  • 2021-11-22
  • 2022-12-23
  • 2022-01-22
  • 2021-08-14
  • 2021-10-21
  • 2021-08-11
  • 2021-06-24
相关资源
相似解决方案