How to scroll ListView to the bottom? How to scroll ListView to the bottom? android android

How to scroll ListView to the bottom?


If you want the list view to be scrolled always at the bottom even when you are updating the list view dynamically then you can add these attributes in list view itself.

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


use the following

    lv.setSelection(adapter.getCount() - 1);


If you would like to have a scroll animation programmatically you could easily scroll to the bottom of the list using:

listView.smoothScrollToPosition(adapter.getCount());

scrolling to the top most of the list can be achieved using:

listView.smoothScrollToPosition(0);