MaterialRefreshLayout, swiperefreshlayout
The above introduces a more beautiful and powerful drop-down refreyout control than SwipeRefreshLayout: Android-MaterialRefreshLayout
1. xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <com.cjj.MaterialRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/refresh" app:wave_color="@color/material_green" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:background="#FF0000" android:layout_width="match_parent" android:layout_height="match_parent"></ListView> </com.cjj.MaterialRefreshLayout> </LinearLayout>
2. Java
Package com. frame. activity; import android. app. activity; import android. OS. bundle; import android. OS. handler; import android. widget. toast; import com. cjj. materialRefreshLayout; import com. cjj. materialRefreshListener; import com. frame. r; public class TestActivity extends Activity {MaterialRefreshLayout materialRefreshLayout; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. test_activity_test); materialRefreshLayout = (MaterialRefreshLayout) findViewById (R. id. refresh); // supports pulling more materialRefreshLayout. setLoadMore (true); materialRefreshLayout. setMaterialRefreshListener (new MaterialRefreshListener () {@ Override public void onRefresh (final MaterialRefreshLayout materialRefreshLayout) {new Handler (). postDelayed (new Runnable () {@ Override public void run () {// pull down to refresh more Toast. makeText (TestActivity. this, "onRefresh... ", Toast. LENGTH_LONG ). show (); materialRefreshLayout. finishRefresh (); }}, 3000) ;}@ Override public void onRefreshLoadMore (final MaterialRefreshLayout materialRefreshLayout) {new Handler (). postDelayed (new Runnable () {@ Override public void run () {// load more Toast. makeText (TestActivity. this, "onRefreshLoadMore... ", Toast. LENGTH_LONG ). show (); materialRefreshLayout. finishRefreshLoadMore () ;}, 3000 );}});}}
3. Reference website
Https://github.com/android-cjj/Android-MaterialRefreshLayout/blob/master/README-cn.md