Android ListView 滚动

发布于 2024-11-18 02:58:50 字数 131 浏览 6 评论 0原文

我有一个 Android ListView,行数非常高,它就像一个垂直的图片库。当我抛出视图时,我希望它精确地停在每个视图的开头。目前它将遍历下一个视图并在两个视图之间停止,这不是我想要的效果。

我可以使用某种设置来实现这种情况吗?

I have an Android ListView with very tall rows and it like a vertical gallery of pictures. When I fling the view I would like it to precisely stop at the start of each view. Currently it will go over the next view and stop betwen 2 views which is not the effect I want.

Is there a setting that I can use to make this happens?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

满天都是小星星 2024-11-25 02:58:50

setSelectionFromTop(int position, int y) 会将列表捕捉到位置,选择位置 y 处的元素并将列表捕捉到所选元素的顶部距顶部 y 像素的位置。这能提供您所需要的吗?

我还没有测试过它,但似乎这与 onScrollStateChanged 或 AdapterView.OnItemSelectedListener 结合会给你一个滚动、捕捉的 ListView。

我希望这有一些用处。

setSelectionFromTop(int position, int y) will snap a list to position, selecting the element at position y and snapping the list to where the top of the selected element is y pixels from the top. Would that provide what you need?

I haven't tested it, but it seems that this combined with onScrollStateChanged or AdapterView.OnItemSelectedListener would give you a scrolling, snapping ListView.

I hope that's of some use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文