我正在使用android ChipView library 。我没有找到任何有关此问题的文档。
请参阅此
compile 'com.github.jakebonk:ChipView:1.0.1'
我查看了代码,但没有方法可以从列表中返回选定的标记。有什么出路吗?
答案 0 :(得分:0)
您需要在项目添加到适配器时保留列表/引用。这是我为类似的库创建的:
participantsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Timber.d("Item clicked position is: " +position);
ParticipantChipInput selectedChip =
participantChipListAdapter.getParticipantChipInputs().get(position);
selectedChip.setSelected(!selectedChip.isSelected());
if (selectedChip.isSelected()) {
participantChipsList.addChip(selectedChip);
} else {
participantChipsList.removeChip(selectedChip);
}
participantChipListAdapter.notifyDataSetChanged();
}
});