2

I have a Listview in Android. I want that the Listview continuously scrolls from top to bottom by itself. It should happen infinitely

And obviously I want to capture the click on any of the items of the Listview, post that the scroll will continue

Anybody having experience with such an implementation. Please help !!

DonGru
  • 13,532
  • 8
  • 45
  • 55
user669231
  • 1,371
  • 3
  • 18
  • 27

1 Answers1

5

http://groups.google.com/group/android-developers/msg/753a317a8a0adf03

To scroll automatically, you can use this: listView.smoothScrollToPosition(position);

private void scrollMyListViewToBottom() {
    myListView.post(new Runnable() {
        @Override
        public void run() {
            // Select the last row so it will scroll into view...
            listView.smoothScrollToPosition(myListAdapter.getCount() - 1);
            // Just add something to scroll to the top ;-)
        }
    });
}
Waza_Be
  • 39,407
  • 49
  • 186
  • 260
  • Will this allow scrolling of the list without user touching the screen? My requirement is that the list keeps on scrolling by itself without any user interaction Thanks – user669231 Sep 22 '11 at 18:49
  • Can you help me with a small working example, I tried using the above snippet but the list straight away goes to the row where the last setselection was called. It doesn't do a autoscroll at all – user669231 Sep 22 '11 at 20:27
  • ListView.smoothScrollToPosition(int i) – Waza_Be Sep 22 '11 at 20:44