1、在你显示ListView的那个activity中定义一个全局变量
private Parcelable state;
2、在初始设置适配器的时候,给state赋初值
adapter = new RecordDetailAdapter(RecordDetailActivity.this, data,lv_record_detail);
lv_record_detail.setAdapter(adapter);
state = lv_record_detail.onSaveInstanceState();
3、在重新刷新适配器的时候,将上次滑到的位置信息赋给ListView
lv_record_detail.onRestoreInstanceState(state);
4、监听listView滑动,将实时的位置信息赋给state
lv_record_detail.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
state = lv_record_detail.onSaveInstanceState();
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
}
});