ListView数据更新后,自动滚动到底部(聊天时常用)| Listview Scroll to the end of the list after updating the list
2014-08-28 19:52
686 查看
转:http://www.cnblogs.com/bjshsqlt/p/3311830.html
If you would like to after you have updated by listAdapter, you want to make sure that the list is scrolled all the way to the bottom,
so that it displays the last element entered in the list. You can do this .
Method1:
mListView.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);
Method2:
set this attribute in XML
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.
If you would like to after you have updated by listAdapter, you want to make sure that the list is scrolled all the way to the bottom,
so that it displays the last element entered in the list. You can do this .
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); } }); }
相关文章推荐
- ListView数据更新后,自动滚动到底部(聊天时常用)| Listview Scroll to the end of the list after updating the list
- ListView数据更新后,自动滚动到底部(聊天时常用)
- Android的ListView,数据更新后自动scroll到底部。
- ListView数据更新后,自动滚动到底部
- Android的ListView,数据更新后可以自动scroll到底部
- 数据更新后让ListView自动滚动到底部
- 内存错误:CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after after the end of heap buffer(这个经常忘掉)
- [vs运行报错] CRT detected that the application wrote to memory after end of heap buffer
- ListView滚动到底部自动加载更多数据
- Scroll to the end of RichTextbox
- CRT detected that the application wrote to memory after end of heap buffer
- ListView滚动到底部自动加载数据
- CRT detected that the application wrote to memory after end of heap buffer.
- 有关“CRT detect that the application wrote to memory after end of heap buffer”问题的解决
- CRT detected that the application wrote to memory after end of heap buffer
- 释放内存free()错误:CRT detected that the application wrote to memory after end of heap buffer:内存访问违规
- 内存错误:CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer
- CRT detected that the application wrote to memory after end of heap buffer