Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在自定义列表视图中,我有一个文本视图和复选框。一旦在列表视图的任何位置选中复选框,该选中位置必须移动到列表视图的最后可见位置下方。我在网上查了一下,但我找不到解决办法。任何人都可以为此提供解决方案,在此先感谢。
那这个呢:
int newPos = listView.getLastVisiblePosition() +1; YourItem item = adapter.getItem(itemPos); adapter.remove(item); adapter.addAt(item, newPos);
注意: 然后您必须实现一个适配器,该适配器提供addAt(YourItem item, int newPos). listView是您的 ListView 并且itemPos是选中复选框的项目的位置。
addAt(YourItem item, int newPos)
listView
itemPos