Recyclerview 实现上拉加载更多

	LinearLayoutManager layoutManager;
layoutManager = new LinearLayoutManager(getActivity());
		layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
		mRecyclerview.setLayoutManager(layoutManager);

mRecyclerview.addOnScrollListener(new OnScrollListener() { 

            @Override
            public void onScrolled(RecyclerView recyclerView, int dx, int dy) { 
                super.onScrolled(recyclerView, dx, dy);
                int visible  = layoutManager.getChildCount();
                int total = layoutManager.getItemCount(); 
                int past=layoutManager.findFirstCompletelyVisibleItemPosition();
                if ((visible + past) >= total){
                        mType=2;page++;
                        initData(); 
                }
            } 
        });

  

SwipeRefreshLayout 和RecyclerView 使用  

你可能感兴趣的:(Recyclerview 实现上拉加载更多)