I have a listview,I want to refresh it when a button is clicked.My problem is when the scroll postion is at the bottom of listview if I refresh the listview by clearing the adapter, again the scroll position will be at the bottom of the listview.I want the scroll postion to be focused at the top of the listview.
check this
listview.setSelection(0);
http://developer.android.com/reference/android/widget/ListView.html#setSelection%28int%29
尝试使用:
myListView.setSelectionAfterHeaderView();
试试这个,位置为0/1。
yourListView.setSelection(position);
You can try this
list.smoothScrollToPosition(0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.