Android – listView slide loaded next page data SCROLL setting

Android-ListView slides to load new data

I encountered a problem, the slide load function in the past was very poor, and I don’t know the reason.

After trying for a long time, I finally tried it out.

I think this method is more in line with the user experience.

It will not feel visually bounced, but it will load straight and smoothly.

The following is the onScrollListener I set

private OnScrollListener scrollListener = new OnScrollListener() {

@Override
public void onScroll(AbsListView view, int firstItem, int visible, int total) {
scrollCount = visible + firstItem;
}

// 0. Stop scrolling 1. Scrolling
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if( scrollState == SCROLL_STATE_IDLE) {
mPosition = view.getFirstVisiblePosition();
View v = view.getChildAt(0);
mTop = (v == null)? 0: v.getTop();

if( scrollCount >= perPage * page && pageCount >= page) {
page++;
loadNextPage();
}
}
}
};

Wait for loading, and after the data is collected, reset the position as follows

listView.setSelectionFromTop(mPosition, mTop);

< p>

Original text: Large column Android-ListView slide to load the next page data Scroll settings

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3540 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.