最近项目中遇到一个问题,小米4的手机。android listview在滚动时无法收到onScrollStateChanged的callback。
导致某个状态无法复位。
处理如下:
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
this.currentFirstVisibleItem = firstVisibleItem;
this.currentVisibleItemCount = visibleItemCount;
}
public void onScrollStateChanged(AbsListView view, int scrollState) {
this.currentScrollState = scrollState;
this.isScrollCompleted();
}
private void isScrollCompleted() {
if (this.currentVisibleItemCount > 0 && this.currentScrollState == SCROLL_STATE_IDLE) {
/*** do the work! ***/
}
}
原文地址:http://blog.csdn.net/lianchen/article/details/41959203