Enable SwipeRefreshLayout in Android Support V4 to Support pulling and loading more.

Source: Internet
Author: User

Enable SwipeRefreshLayout in Android Support V4 to Support pulling and loading more.
Preface there was no pull-down refresh component in the original Android SDK, but this component is indeed a required component of most apps. Fortunately, google has a SwipeRefreshLayout In the v4 package, but this component only supports pull-down refresh and does not support pulling and loading more operations. Therefore, we can simply expand this component to achieve the goal of pulling and downloading.
The basic principle is that it is automatically loaded when it is pulled or rolled to the bottom by judging whether it has been rolled to the bottom of ListView or other views, and then triggering corresponding operations. Here we will describe the ListView. Therefore, we need to listen to the ListView rolling event. When the ListView is rolled to the bottom, the loading operation is automatically triggered. However, when the user supports sliding the screen by fingers and does not scroll, we also need to let it load, therefore, in this case, pull and load more data. Therefore, we need to make a judgment in the touch event. If we get to the bottom and the user is pulling up, we will execute more loading operations.

Related Article

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: info-contact@alibabacloud.com 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.