下载地址:https://github.com/recruit-lifestyle/WaveSwipeRefreshLayout
直接把代码复制到你的项目于即可使用:
使用:
在xml中:
<jp.co.recruit_lifestyle.android.widget.WaveSwipeRefreshLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/main_swipe"> <ListView android:id="@+id/main_list" android:layout_width="match_parent" android:layout_height="match_parent"/> </jp.co.recruit_lifestyle.android.widget.WaveSwipeRefreshLayout>
JAVA代码:
mWaveSwipeRefreshLayout = (WaveSwipeRefreshLayout) findViewById(R.id.main_swipe); mWaveSwipeRefreshLayout.setOnRefreshListener(new WaveSwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // Do work to refresh the list here. new Task().execute(); } }); private class Task extends AsyncTask<Void, Void, String[]> { ... @Override protected void onPostExecute(String[] result) { // Call setRefreshing(false) when the list has been refreshed. mWaveSwipeRefreshLayout.setRefreshing(false); super.onPostExecute(result); } }