ListView数据更新后,自动滚动到底部(聊天时常用)| Listview Scroll to the end of the list after updating the list
2013-09-10 11:26
706 查看
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.
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); } }); }From:http://stackoverflow.com/questions/3606530/listview-scroll-to-the-end-of-the-list-after-updating-the-list
相关文章推荐
- ListView数据更新后,自动滚动到底部(聊天时常用)| Listview Scroll to the end of the list after updating the list
- ListView数据更新后,自动滚动到底部(聊天时常用)
- 数据更新后让ListView自动滚动到底部
- ListView数据更新后,自动滚动到底部
- Android的ListView,数据更新后可以自动scroll到底部
- Android的ListView,数据更新后自动scroll到底部。
- listview滚动到底部自动加载数据
- 有关“CRT detect that the application wrote to memory after end of heap buffer”问题的解决
- 我的Android进阶之旅------>Android的ListView数据更新后,如何使最新的条目可以自动滚动到可视范围内?
- CRT detected that the application wrote to memory after end of heap buffer
- [vs运行报错] 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
- Android 实现ListView滚动到底部自动加载数据
- ListView滚动到底部自动加载更多数据
- Loading Data when the User Scrolls to the End of a List in Windows Phone 7
- Android的ListView数据更新后,如何使最新的条目可以自动滚动到可视范围内
- 调试错误 - CRT detected that the application wrote to memory after end of heap buffer
- [vs执行报错] CRT detected that the application wrote to memory after end of heap buffer
- listview滚动到底部自动加载数据
- 【debug】CRT detected that the application wrote to memory after end of heap buffer