0
我想在對話框上使用自定義視圖。我不斷收到錯誤自定義對話框錯誤:孩子已經有父母
07-09 18:03:38.740: E/AndroidRuntime(22032): java.lang.IllegalStateException:
The specified child already has a parent. You must call removeView()
on the child's parent first.
這裏是我的代碼
LayoutInflater inflater = getLayoutInflater();
View dialoglayout = inflater.inflate(R.layout.activity_mine1,
(ViewGroup) findViewById(R.layout.mine1));
mine1 = new AlertDialog.Builder(this);
mine1.setView(dialoglayout);
mine1.show();
我該如何解決這個問題? (大概我所要做的就是刪除視圖。)