msgListView.setSelection(msgListView.getBottom());
监听listView滑动到底部或顶部
msgListView.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
switch (scrollState) {
// 当不滚动时
case OnScrollListener.SCROLL_STATE_IDLE:
// 判断滚动到底部
if (msgListView.getLastVisiblePosition() == (msgListView.getCount() - 1)) {
}
// 判断滚动到顶部
if (msgListView.getFirstVisiblePosition() == 0) {
getOldMsgs();
}
break;
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});