0
我有孩子意見RelativeLayout
容器,就像這樣:被編程產生如何在相對佈局包含器內的其他兩個視圖之間添加視圖?
[ -> begin of relative layout containner
[view] -> view (LinearLayout)
[view] -> view (LinearLayout) + rule (below of previous view)
[view] -> view (LinearLayout) + rule (below of previous view)
] -> end of relative layout
一切。
事件發生後,我需要在兩個子視圖之間添加一個子項。我做這個:
public void add(PerguntaViewContainner parent, PerguntaViewContainner child) {
PerguntaViewContainner previousChild = parent;
PerguntaViewContainner nextChild = HocusPocus.getNextElementOf(parent);
perguntaParams.addRule(RelativeLayout.BELOW, previousChild.getId());
perguntaParams.addRule(RelativeLayout.ABOVE, nextChild.getId());
containner.addView(child, perguntaParams);
}
但是孩子沒有出現。你有什麼想法,爲什麼會發生?
什麼是PerguntaViewContainner和PerguntaViewContainner?它們如何與RelativeLayout和LinearLayout相關,以及它們爲什麼不在具有視圖結構的'圖表'中提供? – sandrstar