项目作者: xiaojinwei

项目描述 :
RecyclerView的刷新辅助类 http://blog.csdn.net/cj_286/article/details/52767070
高级语言: Java
项目地址: git://github.com/xiaojinwei/RecyclerView.git
创建时间: 2016-10-10T02:22:02Z
项目社区:https://github.com/xiaojinwei/RecyclerView

开源协议:

下载


RecyclerView

RecyclerView的刷新辅助类 http://blog.csdn.net/cj_286/article/details/52767070

使用

  1. <com.cj.recyclerview.refresh.PullRefreshLayout
  2. android:id="@+id/pull"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent">
  5. <android.support.v4.widget.SwipeRefreshLayout
  6. android:id="@+id/swipe"
  7. android:layout_width="match_parent"
  8. android:layout_height="match_parent" >
  9. <android.support.v7.widget.RecyclerView
  10. android:id="@+id/recycler"
  11. android:layout_width="match_parent"
  12. android:layout_height="match_parent"
  13. android:cacheColorHint="@null"
  14. android:scrollbars="vertical" ></android.support.v7.widget.RecyclerView>
  15. </android.support.v4.widget.SwipeRefreshLayout>
  16. </com.cj.recyclerview.refresh.PullRefreshLayout>
  17. mPull.setOnPullListener(new PullRefreshLayout.OnPullListener() {
  18. @Override
  19. public void onLoadMore(final PullRefreshLayout pullRefreshLayout) {
  20. new Thread(new Runnable() {
  21. @Override
  22. public void run() {
  23. SystemClock.sleep(2000);
  24. mDatas.add(mDatas.size() + "");
  25. runOnUiThread(new Runnable() {
  26. @Override
  27. public void run() {
  28. adapter.notifyDataSetChanged();
  29. pullRefreshLayout.setRefreshing(false);
  30. }
  31. });
  32. }
  33. }).start();
  34. }
  35. });