我有一个回收器视图,可以向上/向下拉动以加载更多/刷新数据。 当我拉起来时,一切都很好。但是当我清除Recycler的刷新数据时,recyclerView setOnScrollListener不起作用。 感谢。
recyclerView.setOnScrollListener(new EndlessRecyclerOnScrollListener(manager) {
@Override
public void onLoadMore(int current_page) {
Toast.makeText(G.context, "load more", Toast.LENGTH_SHORT).show();
simulateLoading();
refreshWorkList();
}
});
mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
page = 0;
recyclerDatas.clear();
adapViewWrkLst.notifyDataSetChanged();
mSwipeRefreshLayout.setRefreshing(false);
initRecyclerView();
simulateLoading();
refreshWorkList();
}
});
public void initRecyclerView() {
manager = new LinearLayoutManager(this);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(manager);
recyclerView.clearOnScrollListeners();
}