从数值上滚动一个ListView消失 - 机器人数值、机器人、ListView

2023-09-05 01:16:19 作者:你的心是我无法登陆的岛

我从SimpleCursorAdapter扩展自定义适配器。使用此我结合一个ListView包含一个复选框和两个文本框。在开幕活动中,列表显示正常。但在点击复选框,并在文本框中输入一些文字和滚动下来,然后再次,数据就会消失。

I have a custom adapter extended from the SimpleCursorAdapter. Using this I'm binding a ListView which contains a checkbox and Two textboxes. On opening the activity, the list appears fine. But on clicking the checkboxes and entering some text in the textboxes and scrolling down, and then up again, the data disappears.

其实任何改变消失,即使他们已经检查。我取消选中它们,然后向下滚动,向上,在回去检查。所以基本上,他们回去任何状态,他们在检索。

In fact any change disappears, even if they were already checked. I uncheck them, then scroll down and up, the go back to checked. So basically, they go back whatever state they were when retrieved.

任何想法,为什么?谢谢你。

Any ideas why? Thanks.

推荐答案

您需要在列表中每个项目的状态的ArrayList ,,那么每一次的列表项的看法是loaded.Do这个由加载这些状态在适配器压倒一切的GetView()方法,并添加您的保存状态,根据项目位置列表

You need to have an arraylist of the states of each item in the list,, then load these states each time the list item view is loaded.Do this by overriding GetView() method in the adapter and add your saved state to the list based on the item position