开发者

How to set scroll position to top of a listview

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开发者_Python百科 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


Try using:

myListView.setSelectionAfterHeaderView();


Try this, with position to 0/1.

yourListView.setSelection(position);


You can try this

list.smoothScrollToPosition(0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜