Content of this article
- Development environment
- Demo up and down pull refresh latest and load more ListView
- Resources
This article shows up and down pull, refresh up-to-date and load more, this effect is very common, for example, news APP, when pull down, load the latest information; pull up, load more before.
Development environment
- Windows R2 64-bit
- ADT V22.6.2
Demo up and down pull refresh latest and load more ListView
Figure 1 Left: Main program; Middle: Pull down to refresh latest; Right: Pull up to load more
For specific code, download the demo code later in this article.
Description
- The custom control Pulllistview and its listener pulllistviewlistener, where Pulllistview inherit the ListView and Onscrolllistener, implement up and down pull ListView refresh up-to-date and load more;
- Custom state control Statusview,statusview inherit LinearLayout, implement add Pulllistview top and bottom, when pull up and down, display corresponding state information;
- State enumeration Refreshstatus, which indicates the category of status information.
Resources
- Android.widget.AbsListView.OnScrollListener
- Android.widget.ListView
- Java.lang.Thread
Download Demo