In Gingerbread, I had no issues with using smoothScrollToPosition() to scroll across dozens of items at a time. After my Nexus S was upgraded to Ice Cream Sandwich, I noticed th
This is what I did to resolve the issue. Essentially, we want to keep calling smoothscrolling until you reach the desired element (in this case, I simply want to scroll to the top, which is element 0).
//There is a known bug where smoothScrollToPosition(..) may not reach the top,
//if the list is very large, keep scrolling until you reach the top element
newsFeed.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
if(firstVisibleItem != 0) {
newsFeed.smoothScrollToPosition(0);
}
else {
//We are done
newsFeed.setOnScrollListener(null);
}
}
});
newsFeed.smoothScrollToPosition(0);