我有一个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);
}
但是孩子没有出现。你有什么想法,为什么会发生?