Android ListView 跳转到光标位置

标签 android listview

我有一个由标准 BaseAdapter 控制的 ListView。

当用户单击按钮时,我希望 ListView 滚动到查看第 100 条记录。

这是怎么做到的?

最佳答案

试试这个功能

public void setSelection (int position)

Since: API Level 1 Sets the currently selected item. If in touch mode, the item will not be selected but it will still be positioned appropriately. If the specified selection position is less than 0, then the item at position 0 will be selected. Parameters position Index (starting at 0) of the data item to be selected.

所以 myListView.setSelection(99);

关于Android ListView 跳转到光标位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3452878/

相关文章:

Android ListView 项目被重复

java - Android:在 ListView 中删除行时 IndexOutOfBounds 错误

java - 是否可以使用条件定义添加 @Override 关键字(我的意思是仅在某些 API 版本上)

android - 通过电话进行 Firebase 电话身份验证

android - MD5签名如何影响应用程序安全?

android - 这两个版本有和没有 "-k419"有什么区别?

android - acharEngine Donut 在 android 中有额外的显示,如何删除它们?

listview - 如何从 QML 中的 ListView 访问 currentItem 的角色?

wpf - 如何将控件绑定(bind)到 WPF ListView 列

wpf - 防止用户使用 WPF ListView 调整列大小