我在列表中选择一个项目进行编辑(我使用上下文菜单),然后填充数据以“刷新”列表,我的列表将以“自上而下”的顺序显示。我想在我刚刚编辑的项目的位置显示我的列表(我不必向下拖动滚动条来找到它)。那么,我该怎么做呢?
最佳答案
使用 ListView.setSelection(int position)
方法。它将选择指定位置的列表项,但前提是不在触摸模式下。如果在触摸模式下,它只会滚动到指定的位置,以便 position
的项目是屏幕上的第一个。
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.
关于android - 设置ListView在android中 "item edited"位置右显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1345875/