The specified child already has a parent. You must call removeView() on the child's parent first.的解決辦法
摘要: 出現(xiàn)The specified child already has a parent. You must call removeView() on the child's parent first.這個(gè)問題,一般原因是對layout.xml的使用理解不清楚。以xml文件方式來設(shè)計(jì)界面的布局,如果需要?jiǎng)討B(tài)的對xml文件中的各類View進(jìn)行修改的話,在代碼中使用時(shí),不能直接使用this.findViewById(R.id.***)來獲取xml文件中的每個(gè)View,然后再將這些View加入到代碼中的Layout中來進(jìn)行顯示。正確的做法應(yīng)該是使用inflater。
閱讀全文
posted @ 2010-12-11 22:28 江天部落格 閱讀(8101) | 評論 (0) 編輯