I would like to make sure that the list is scrolled all the way to the bottom, after I have updated the listview by using listAdapter, so that it displays the last element entered in the list. How can I do this ?
I tried this but no luck:
lv.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
thank you
To get this in a ListFragment:
Added this answer because if someone do a google search for same problem with ListFragment he just finds this..
Regards
I use
to add entries at the bottom, and older entries scroll off the top, like a chat transcript
The simplest solution is :
I've had success using this in response to a button click, so I guess that you can use it too after updating your contents:
Using : Set the head of the list to it bottom
lv.setStackFromBottom(true);
Worked for me and the list is scrolled to the bottom automatically when it is first brought into visibility. The list then scrolls as it should with
TRANSCRIPT_MODE_ALWAYS_SCROLL
.The transcript mode is what you want and is used by Google Talk and the SMS/MMS application. Are you correctly calling notifyDatasetChanged() on your adapter when you add items?