我越来越
E/AndroidRuntime(855): Caused by: java.lang.IllegalStateException:
The specified child already has a parent. You must call removeView()
on the child's parent first.
我正在运行的代码,错误发生在 linearLayout.addView(view);
view = getFieldControl(field);
linearLayout.addView(view);
getFieldControl 看起来像这样(简化):
private android.view.View getFieldControl(ControlTemplate control)
{
View view =null;
view = (EditText)findViewById(R.id.edit_message);
((EditText) view).setHint(control.getName());
((EditText) view).setText(control.getValue());
return view;
}
我不明白父级的视图可能是什么,我应该从哪里删除它?