Android ListView 滚动
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.