I am in a team which is building an app for a tablet which reacts like a magazine.
We’re using ListView to display one article having multiple pages.
Each row contains a lot of data, and is used to represent a page of a magazine.
One row takes almost whole of the screen in portrait mode, so one row == one screen
As of now, when a user scrolls this whole ListView, it behaves the way a normal ListView would –
- if you flick fast enough, it will scroll fast
- if you scroll slowly, scrolling stops as soon as you stop vertical motion of the finger
What I want-
- No matter how fast or slow a user scrolls/flicks (makes a finger movement in vertical direction), only one single row should be scrolled.
Is there a way I can control how the ListView is being scrolled?
I searched a lot, quite a number of articles suggesting how to scroll to top or to a particular position, but no one actually tells how the scrolling happens so that I can control it.
Am I missing something?
ListView uses a Scroller (OverScroller past GingerBread 2.3) which has private access. Not sure if this will help you out but it can point you in the right direction. To get the behaviour you want you can try the following(I have only tested this on a ScrollView):
Then add an ontouchlistener to uour ListView and scroll on touch up:
An alternative to the solution above you can try the following:
on touch up:
yourListView.smoothScrollToPosition(LIST_ITEM_INDEX);