Listview scrolling pages/scrolling loads (similar to the list of Android Market)

Source: Internet
Author: User

1. Scroll Loading

 

Listview. setonscrolllistener (New onscrolllistener () {// Add the scroll bar to the bottom and load the remaining elements @ override public void onscrollstatechanged (abslistview view, int scrollstate) {If (scrollstate = onscrolllistener. scroll_state_idle) {loadremnantlistitem () ;}@ override public void onscroll (abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) {}}); listview. setonitemselectedlistener (New onit Emselectedlistener () {// press the key to select the item in the list. The focus is on the bottom view to load the remaining item @ override public void onitemselected (adapterview <?> Parent, view, int position, long ID) {If (footerview = view) {loadremnantlistitem (); listview. setselection (position-1) ;}}@ override public void onnothingselected (adapterview <?> Parent) {}}); Private void loadremnantlistitem () {// rolls to load the remaining data // dynamically changes the listadapter. getcount () Return Value // use handler to call listadapter. notifydatasetchanged (); update data}

2. Rolling pages

 
// Listview listenerCodeSame private void loadremnantlistitem () {// roll to load the remaining data // re-listview. setadapter (newsadapter); // use handler to call listadapter. notifydatasetchanged (); update data}

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.