Method1:
mListView.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
Method2:
set this attribute in XML
android:transcriptMode="alwaysScroll"
Method3:
if the above two methods fail, you can try this:
you can manually tell the list to scroll to the bottom by setting the list selection to the last row.
private void scrollMyListViewToBottom() {
myListView.post(new Runnable() {
@Override
public void run() {
// Select the last row so it will scroll into view...
myListView.setSelection(myListAdapter.getCount() - 1);
}
});
}
本文介绍了在Android开发中将ListView滚动到底部的三种实用方法:通过代码设置transcript模式、在XML布局文件中配置属性以及手动设置ListView选择项为最后一项。

962

被折叠的 条评论
为什么被折叠?



