Drop-down refresh of the Water Drop effect -- third-party open source -- WaveSwipeRefreshLayout and swiperefreshlayout
: Https://github.com/recruit-lifestyle/WaveSwipeRefreshLayout
You can directly copy the code to your project:
Usage:
In 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 code:
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); }}