Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个行非常高的 Android ListView,它就像一个垂直的图片库。当我抛出视图时,我希望它准确地停在每个视图的开头。目前它将遍历下一个视图并在 2 个视图之间停止,这不是我想要的效果。
有没有我可以用来实现这一点的设置?
setSelectionFromTop(int position, int y) 将列表对齐到位置,选择位置 y 处的元素并将列表对齐到所选元素的顶部距顶部 y 像素的位置。那会提供你需要的东西吗?
我还没有测试过,但似乎这与 onScrollStateChanged 或 AdapterView.OnItemSelectedListener 结合起来会给你一个滚动的、捕捉的 ListView。
我希望这有点用。