//布局里
<android.support.v4.widget.SwipeRefreshLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/sw" > <android.support.v7.widget.RecyclerView android:id="@+id/id_recyclerview" android:divider="#ffff0000" android:layout_width="match_parent" android:layout_height="match_parent" /> </android.support.v4.widget.SwipeRefreshLayout>
sw.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { List<Bean> lists=new ArrayList<Bean>(); lists.addAll(list); list.clear(); list.addAll(lists); adapter.notifyDataSetChanged(); sw.setRefreshing( false ); } });