简体   繁体   English

刷新时禁止在列表视图中滚动

[英]Disable scrolling in listview on refresh

the problem is I so some changes on the list and than it is always scrolling to the top. 问题是我在列表上进行了一些更改,因此总是滚动到顶部。 I know that I can make to scroll to the bottom but that is not what I want. 我知道我可以滚动到底部,但这不是我想要的。 I want to disable scrolling, I mean when I do a change on the list I want the to stay there I do not want to scroll to the top. 我想禁用滚动,这是指当我在列表上进行更改时,我想要停留在那儿,但我不想滚动到顶部。 I just want my scroll to do not change(just to stay in the same place where it is) I try to do this to set the transcrip mode of the list to disabled, but it still after the change the list go to the top. 我只是希望我的滚动条不发生变化(只是保持在原处),我尝试执行此操作以将列表的转录模式设置为禁用,但是在更改后,列表仍会移到顶部。

lv.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_DISABLED);

If you call setAdapter you can't avoid that your list is scrolling back to top. 如果调用setAdapter ,将无法避免列表滚动回到顶部。 But it will stay at the same position if you call notifyDataSetChanged on the list adapter. 但是,如果您在列表适配器上调用notifyDataSetChanged ,它将保持在相同位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM