0

我正在使用 android ChipView 库 。我没有找到任何关于此的文档。

请参考这个

compile 'com.github.jakebonk:ChipView:1.0.1'

我浏览了代码,但没有从列表中返回选定标签的方法。有什么出路吗?

4

1 回答 1

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();
        }
    });
于 2018-02-20T14:42:43.497 回答