gpt4 book ai didi

android - Listview - 如何从第 10 项平滑滚动到顶部?

转载 作者:行者123 更新时间:2023-11-29 20:05:42 24 4
gpt4 key购买 nike

我将第 10 项列为 ListView 中最可见的一项。我需要平滑滚动到顶部项目。当我执行以下操作时,它只停留在从顶部开始的第 6 个项目附近,不会滚动到顶部。

lstConvList.setSelectionFromTop(10, 30);
lstConvList.smoothScrollToPositionFromTop(0, 0, MyMessage.SCROLL_UP_DURATION);

最佳答案

参见 this answer .

引用:

First call smothScrollToPositionFromTop(position) and then, when scrolling has finished, call setSelection(position). The latter call corrects the incomplete scrolling by jumping directly to the desired position. Doing so the user still has the impression that it is being animation-scrolled to this position.

关于android - Listview - 如何从第 10 项平滑滚动到顶部?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35680914/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com