Open FranPR9 opened 7 years ago
Same here. In my case I still didn't see it working. I will investigate a bit, let's see if I find something.
Hi @FranPR9
I've fixed this by adding a method to ChipsInput class to add a list of chips. Then I forward it to the adapter and in the adapter it looks like this:
public void addChipsProgrammatically(List<ChipInterface> chipList){
if(chipList != null){
if(chipList.size() > 0) {
int chipsBeforeAdding = getItemCount();
for (ChipInterface chip : chipList) {
mChipList.add(chip);
mChipsInput.onChipAdded(chip, getItemCount());
}
// hide hint
mEditText.setHint(null);
// reset text
mEditText.setText(null);
notifyItemRangeChanged(chipsBeforeAdding, chipList.size());
}
}
}
Most likely, the problem comes from notifying recyclerview about item added just after setting adapter. Could that be correct?
I hope this helps, maybe soon I will make another PR.
I didn't try your solution, but for me it worked to make the chipsinput visible until it has chips in its list. I think the problem has to do with the recycler being notified at a certain time for it to be resized. thanks @mathias21
solved this in a similar way by setting a minHeight in XML. stops the initial resizing to be messy I assume.
I have the same problem and tried all of the above solutions but it has existed. Does anybody have other idea?
I get this: java.lang.IllegalArgumentException: Called attach on a child which is not detached: ViewHolder{15b78fb4 position=4 id=-1, oldPos=-1, pLpos:-1 not recyclable(0)} whenever I try to:
chipsInput.addChip(contact);
of course contact class implementsChipInterface
sometimes it do work, most of the time it gives me this error