Saving scroll position in the ListView [duplicate]

会有一股神秘感。 提交于 2019-12-24 20:51:15

问题


Possible Duplicate:
Maintain/Save/Restore scroll position when returning to a ListView

how to save scroll position in the ListView? I should to add elements into the head of the ListView and into an arbitrary position, but visual part should NOT be scrolled.

for example I have 123 elements, I see 1/2 part of the element with index 66 (elements have a different height). I added an element into the list, and I should to see 1/2 part of the element with index 67 (previously index 66).

you can see as example - default "SMS" application for windows phone 7.5. This application uses the lazy-loading


回答1:


you can use getSelection() and setSelection() method

Get the current selection using getSelection() and when you comes back to that ListView again the call setSelection()



来源:https://stackoverflow.com/questions/11187837/saving-scroll-position-in-the-listview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!