在实施分页时.我遇到了这个问题.不滚动onscrolled方法不断调用.请检查下面的代码.
作为参考,我正在使用带有AdapterViews和RecyclerView的Endless Scrolling
还有一个演示的例子此.
我正在从API请求数据.所以我实施了凌空.安装完成后,发生了奇怪的事情 OnScrolled方法连续调用而不滚动.以下是我的代码.
HomeFragment.java
view = inflater.inflate(R.layout.fragment_home, container, false);
tvNoDataFound = (TextView) view.findViewById(R.id.tv_no_data_found);
recyclerView = (RecyclerView)view.findViewById(R.id.listView);
linearLayoutManager = new LinearLayoutManager(getActivity());
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setLayoutManager(linearLayoutManager);
context = view.getContext();
// Lookup the swipe container view
swipeProjects = (SwipeRefreshLayout)view.findViewById(R.id.swipeProjects);
// Setup refresh listener which triggers new data loading
swipeProjects.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
// Your code to refresh the list here.
// Make sure you call swipeContainer.setRefreshing(false)
// once the network request has completed successfully.
getProjects(0,0); …Run Code Online (Sandbox Code Playgroud)