Tag: parent child

指定的孩子已经有一个父母。 您必须先调用父级的removeView()(Android)

在我的应用程序中,我不得不经常在两个布局之间切换。 错误发生在下面的布局中。 当我的布局第一次被调用,没有发生任何错误,一切都很好。 当我然后调用不同的布局(一个空白的),然后再次调用我的布局,它给了我以下错误: > FATAL EXCEPTION: main > java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 我的布局代码如下所示: tv = new TextView(getApplicationContext()); // are initialized somewhere else et = new EditText(getApplicationContext()); // in the code private void ConsoleWindow(){ runOnUiThread(new Runnable(){ @Override public void run(){ // MY […]