Last active
August 29, 2015 14:10
-
-
Save soe/0222acb314bb900d2a5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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