Android ScrollView and ListView are used, and the ListView can be pulled down to refresh and pull up loaded

Source: Internet
Author: User

ScrollView nested listview and the ListView can implement pull-up loading.

Because the code is too long, this only provides implementation ideas:

First of all, let's recall the solution that ScrollView and Lsitview use when they're loaded. 1. Disable the swipe up and down of the ListView, 2. Calculate the height of each item in the ListView, 3. Customize the ListView. Listed after each scenario is basically the sliding of the ListView is disabled, if the top and bottom of the ListView to disable the drop off the pull-up loading and drop-down refresh said, thus we come to the conclusion that If you want to implement ScrollView and the ListView and can pull down or pull up to dry something. It's obviously difficult to start a ListView, so let's try to figure out how to ScrollView. Right, the way I realized it was from ScrollView.

Implementation method:

Simple scenario: Notifies the ListView update UI when ScrollView slides to the bottom, notifies ScrollView to stop loading the animation when the ListView update UI is finished.

You can do some complex scenarios based on simple scenarios, which is equally applicable.

Android ScrollView and ListView are used, and the ListView can be pulled down to refresh and pull up loaded

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.