How to use super easy refreshlayout

Super easy refresh layout is a powerful and easy-to-use pull-down refresh control. It is implemented by referring to the principle of swipe refresh layout provided by Google

Super easy refresh layout is a container in nature. You can put the sliding view into the container to realize pull-down refresh and pull-up loading more functions. The supported child views are ListView, RecyclerView, GridView and ScrollView.

Super easy refresh layout is very simple to use, similar to the swipeerefresh layout provided by Google, but it is much more powerful than the function. You can put the sliding view into the container to achieve pull-down refresh and pull-up loading more functions. The supported views are ListView, RecyclerView, GridView and ScrollView. The following uses ListView as an example.

<com.honor.fighting.supereasyrefreshlayout.view.SuperEasyRefreshLayout
    android:id="@+id/swipe_refresh_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ListView
        android:id="@+id/list_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</com.honor.fighting.supereasyrefreshlayout.view.SuperEasyRefreshLayout>

activity

swipe_refresh_layout = (SuperEasyRefreshLayout) findViewById(R.id.swipe_refresh_layout);
swipe_refresh_layout.setOnRefreshListener(new SuperEasyRefreshLayout.OnRefreshListener() {
    @Override
    public void onRefresh() {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                swipe_refresh_layout.setRefreshing(false);
                Toast.makeText(ListViewActivity.this,"Refresh successful",Toast.LENGTH_SHORT).show();
            }
        },2000);
    }
});

swipe_refresh_layout.setOnLoadMoreListener(new SuperEasyRefreshLayout.OnLoadMoreListener() {
    @Override
    public void onLoad() {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                swipe_refresh_layout.finishLoadMore();
                Toast.makeText(ListViewActivity.this,"Load more success",Toast.LENGTH_SHORT).show();
            }
        },2000);
    }
});

ListView and RecyclerView drop-down refresh effect

ListView and RecyclerView pull up to load more effects

ScrollView drop down refresh effect

GridView drop down refresh effect

Source code

Tags: Android Google

Posted on Wed, 13 Nov 2019 14:05:00 -0500 by Pethlehemm