[問題] android 的addView 問題
我的程式是一個ActivityGroup
layout 只包含一個我自己繼承View的 子類別
而我有另外一個Activity 叫ChessTimer
我利用
View decorView = getLocalActivityManager()
.startActivity("ChessTimer", intent).getDecorView();
myLayout = (LinearLayout) findViewById(R.id.mainlayout);
myLayout.addView(decorView);
這個動作把ChessTimer鑲嵌在我原本的View的後方
執行也正常
我的問題在於:
當我想要刪除ChessTimer的畫面的時候
myLayout.removeViewAt(1);
產生錯誤:
08-20 02:25:14.164: ERROR/AndroidRuntime(1102):
java.lang.IllegalStateException: The specified child already has a parent.
You must call removeView() on the child's parent first.
請問到底是出了什麼問題呢??
ChessTimer 的 DecorView 的老爸不就是 myLayout嗎?
為什麼會這樣呢??
--
肝不好 ▁▁ ● ◤ 肝若好
人生是黑白的 ▏ ◤ 考卷是空白的
▏ ◤ 、 ﹐
● ●b 囧 ▎ ●> ● ◤ ▌ ﹍﹍ 0 ▊囧> 幹...
▲ ■┘ ■ ▎ ■ █◤ ▌ ㄏ▋ ︶■
〈﹀ ∥ ▁▁∥ ▎ ﹀〉◤ ▋ ▊ 〈\ ψcockroach727
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.232.58.39
→
08/20 18:14, , 1F
08/20 18:14, 1F