무슨 일이 일어나고 있는지 모르겠습니다. 내 코드가 충돌하고 이유를 찾지 못합니다.지정된 자식에는 이미 부모가 있습니다.
저는 여러 WebViews의 컨테이너 인 LinearLayout을 가졌습니다.
LinearLayout variableContent = (LinearLayout) this.findViewById(R.id.variableContent);
for (int i=0; i<5;i++){
XMLModule modul = modulsRecuperats.get(i);
myWebView webview = new myWebView(this);
WebView customWebViewContainer = (WebView) this.mInflater.inflate(R.layout.customwebview, null);
customWebViewContainer = webview._clientSettings(customWebViewContainer,progressDialog);
customWebViewContainer.loadData(modul.getContent(), "text/html", "UTF-8");
variableContent.addView(customWebViewContainer);
}
addView를 호출하면 코드가 충돌합니다. 이 오류 :
Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
이유를 찾을 수 없습니다. 너 나 좀 도와 줄 수있어?
variableContent에 이미 일부 콘텐츠가있는 것으로 보입니다. variableContent.removeView()를 수행 한 다음 for 루프를 호출 할 수 있습니다. – lokoko
하지만 선형 레이아웃은 여러 개의 하위를 포함 할 수있는 레이아웃이기 때문에 의미가 없습니다 ... – Reinherd