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 I show the screen I want it to scroll to the bottom, so the most recent items are displayed, but in a logical "end of the thing" sort of way.
m_list.setSelection(m_list.getCount()-1);
Kewl as... but :( Now my list won't scroll. It seem stuck on the bottom. I can see the "truck" and it's tiny and at the bottom.
Ok.. so my questy is thus.. How do I start off by scrolling to the bottom, but still allow the user (me) to scroll up when they (me again) want to scroll up.
set the following on your listview
in the XML.
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
You can use following code to reach at bottom of list view.
listView.postDelayed(new Runnable() {
@Override
public void run() {
listView.setSelection(listView.getCount());
}
}, 500);
This will set delay of 500 ms. Or you can use
listView.post(new Runnable() {
@Override
public void run() {
listView.setSelection(listView.getCount());
}
});
This will scroll your list view pragmatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With