RecyclerView and SwipeRefreshLayout

后端 未结 12 1906
再見小時候
再見小時候 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:13

    Single line solution.

    setOnScrollListener is deprecated.

    You can use setOnScrollChangeListener for same purspose like this :

    recylerView.setOnScrollChangeListener((view, i, i1, i2, i3) -> swipeToRefreshLayout.setEnabled(linearLayoutManager.findFirstCompletelyVisibleItemPosition() == 0));
    

提交回复
热议问题