Superswiperefreshlayout a powerful custom pull-down refresh component

Source: Internet
Author: User


A powerful custom pull-down refresh component.


Pull down to refresh the control, presumably we use too much, such as the use of a lot of xlistview and so on. Recently, many of the listings in the project were implemented using Reyclerview instead of the original ListView, which was challenged by the original dropdown refresh method. Google's swiperefreshlayout has been able to meet most of the needs. However, because of its poor customization, the style of the dropdown refresh cannot be modified, and the nested view cannot follow the swipe of the finger. Based on the above considerations, customize your own powerful superswiperefreshlayout.

    • Non-intrusive, no effect on the original ListView, Recyclerview, usage and swiperefreshlayout similar.
    • You can customize the style of the head view, call the Setheaderview method to
    • Support MORE: Recyclerview,listview,scrollview,gridview and so on.
    • Included view (Recyclerview,listview etc) can slide with the slide of the finger
      The default is to follow the slide of the finger and slide, can also be set to do not follow: Settargetscrollwithlayout (False)
    • Callback Methods more
      For example: Onrefresh () onpulldistance (int distance) and onpullenable (Boolean enable)
      Developers can make a series of animations based on the values of distance in the drop-down process.

How to Usestep 1
<net.mobctrl.views.SuperSwipeRefreshLayoutandroid:id="@+id/swipe_refresh" android:layout_width="Match_parent"android:layout_height="Match_parent" >                                <"@+id/recycler_view" android:layout_width="Match_parent"android:layout_height="Match_parent" />                                    </net.mobctrl.views.SuperSwipeRefreshLayout>
Step 2
Swiperefreshlayout = (superswiperefreshlayout) Findviewbyid (; Swiperefreshlayout.setheaderview (Createheaderview ());//Add HeaderviewSwiperefreshlayout. Setonpullrefreshlistener (NewOnpullrefreshlistener () {@Override                     Public void Onrefresh() {//todo Start Refresh}@Override                     Public void onpulldistance(intDistance) {//todo drop-down distance}@Override                     Public void onpullenable(BooleanEnable) {//todo drop-down is sufficient to set the distance to refresh}                });
Step 3
    • Create Your header view
swipeRefreshLayout.setHeaderView(createHeaderView());// add headerView/** * create Header View */privatecreateHeaderView(){   //TODO 创建下拉刷新头部的View样式}
Sliding settings with hand
    • Settargetscrollwithlayout (false/true);//default true
Support View
    • Recyclerview.
    • Listview
    • Srcollview
    • Gridview
    • etc.



If necessary, you can add more features to the pull-up load.


Github Https://

SOURCE Analysis

Follow up with time updates

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Superswiperefreshlayout a powerful custom pull-down refresh component

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.