4

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?

  • There is another Stack overflow post here: [Snap to with a ListView](http://stackoverflow.com/questions/4432261/list-view-snap-to-item) This should hopefully give you enough of a starting point although this post is so old, you may not care. – TChadwick Oct 17 '12 at 14:57
  • Andrew, Did you find a solution? – benkol Feb 18 '14 at 11:10

1 Answers1

1

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.

Phillip Fitzsimmons
  • 2,915
  • 2
  • 21
  • 20