LRH1993/AutoFlowLayout

对于布局有什么要求吗,为什么报错,

liguangze opened this issue · 0 comments

Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.

/**
* 设置数据适配器
* @param adapter
*/
public void setAdapter(FlowAdapter adapter) {
mAdapter = adapter;
if (mAdapter.getCount() != 0) {
for (int i = 0; i < mAdapter.getCount(); i ++) {
View view = mAdapter.getView(i);
addView(view);
}
requestLayout();
}
}

addView的时候报错呢,我在下面初始化了一个list,有影响吗