RecyclerView and SwipeRefreshLayout

后端 未结 12 1907
再見小時候
再見小時候 2020-12-22 15:46

I\'m using the new RecyclerView-Layout in a SwipeRefreshLayout and experienced a strange behaviour. When scrolling the list back to the top sometim

12条回答
  •  醉酒成梦
    2020-12-22 16:11

    Source Code https://drive.google.com/open?id=0BzBKpZ4nzNzURkRGNVFtZXV1RWM

    recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
    
        public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
        }
    
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            swipeRefresh.setEnabled(linearLayoutManager.findFirstCompletelyVisibleItemPosition() == 0);
        }
    });
    

提交回复
热议问题