如何将滚动在编程列表的底部? [英] how to move scroll at the bottom of list Programmatically?

查看:119
本文介绍了如何将滚动在编程列表的底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在调用notifydatasetchanged后();

i after calling notifydatasetchanged();

我要移动列表滚动到列表的底部,以便用户能看到最后一个记录的listview.actually我写聊天室模块中,以便用于这一目的,我需要最新的记录,在列表的底部。

i want to move scroll of list to the bottom of list so that user could see last record in the listview.actually i am writing Chat module so for that purpose i need latest record at the bottom of list.

任何一个可以指导我如何实现这一目标?

can any one guide me how to achieve this?

任何帮助将appriciated。

any help would be appriciated.

推荐答案

尝试

listView.post(new Runnable(){
  public void run() {
    listView.setSelection(listView.getCount() - 1);
  }});

后似乎是需要在我的经验有时,特别是如果你有最近更新的列表中。

The 'post' seems to be required sometime in my experience, particularly if you have very recently updated the list.

这篇关于如何将滚动在编程列表的底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆