Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save soe/0222acb314bb900d2a5d to your computer and use it in GitHub Desktop.
Save soe/0222acb314bb900d2a5d to your computer and use it in GitHub Desktop.
1、SwipeRefreshLayout下只能有一个具有scroll功能的子View(ScrollView、ListView、RecyclerView等),子View可以有多个子View
2、实现上拉加载更多,利用RecyclerView的LayoutManger实现
mRecyclerView.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrolled(int dx, int dy) {
if(mLayoutManager.findLastVisibleItemPosition() == dataset.length-1){
Log.d("onScrolled", "end");
dataset[dataset.length-1] = "正在加载...";
adapter.notifyItemChanged(dataset.length-1);
}
}
@Override
public void onScrollStateChanged(int newState) {
// TODO Auto-generated method stub
}
});
参考:http://my.oschina.net/longkai/blog/308907
http://www.verydemo.com/article_c440_i463153.html
http://www.cnblogs.com/sunzn/p/3795009.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment