Skip to content Skip to sidebar Skip to footer

Android Scroll To The Bottom Of A Listview

this is not a repeat of another question.. it's more an expansion. I hope :) I've a list view with a few hundred items in it.. They are date stamped entries in another view. When

Solution 1:

set the following on your listview in the XML.

android:stackFromBottom="true"android:transcriptMode="alwaysScroll"

Solution 2:

You can use following code to reach at bottom of list view.

listView.postDelayed(newRunnable() {
        @Overridepublicvoidrun() {
            listView.setSelection(listView.getCount());
        }
    }, 500);

This will set delay of 500 ms. Or you can use

listView.post(newRunnable() {
        @Overridepublicvoidrun() {
            listView.setSelection(listView.getCount());
        }
    });

This will scroll your list view pragmatically.

Post a Comment for "Android Scroll To The Bottom Of A Listview"