Content
- Development Environment
- Demonstrate how to pull up and down to refresh the latest and load more ListView
- References
This article demonstrates how to pull up and down, refresh the most, and load more. This effect is very common. For example, when news and information apps pull down, load the latest information. When pushing up, before loading more.
Development Environment
- Windows 2008 R2 64-bit
- ADT V22.6.2
Demonstrate how to pull up and down to refresh the latest and load more ListView
Figure 1 left: Main Program; middle: Pull down to refresh latest; Right: Pull up to load more
The code is tedious and will not be posted ~ For specific code, please download the Demo after this article.
Note:
- The custom control PullListView and its listening PullListViewListener. PullListView inherits the ListView and OnScrollListener, enabling the upper and lower pull ListView to refresh and load more;
- The custom Status Control StatusView inherits LinearLayout and adds the top and bottom of the PullListView. When the PullListView is pulled up and down, the corresponding status information is displayed;
- Status enumeration RefreshStatus indicates the type of status information.
References
- Android. widget. AbsListView. OnScrollListener
- Android. widget. ListView
- Java. lang. Thread
Download Demo