简体   繁体   English

如何获取单击复选框的行的ListView位置和相应的SimpleAdapter数据?

[英]How to get ListView position and corresponding SimpleAdapter data of the row where checkbox was clicked?

我有一个ListView ,显示用户names.The ListView得到从这个数据SimpleAdapter在此。每个列ListView有一个TextView ,显示用户名和一个ComboBox ,其用于选择相应name.The问题,我不知道该怎么获取当前检查的CheckBox行位置和相应的SimpleAdapter数据。如何实现这一目标?

If I understand your question correctly, you want to find the index of the view which contains a checked checkbox. 如果我正确理解您的问题,您希望找到包含已选中复选框的视图的索引。

Try this to get the index: 试试这个来获取索引:

int index = listView.indexOfChild(checkBox.getParent());

Once you have the index, you can do this to get the data: 获得索引后,可以执行此操作以获取数据:

View customView = listView.getChildAt(index);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM