以编程方式清除RelativeLayout的内容 - android java

Kyl*_*yle 1 android relativelayout imageview

我根据用户输入动态地将ImageViews添加到RelativeLayout.我还创建了一个按钮,按下该按钮时,应清除该RelativeLayout的所有内容(删除所有子项).我希望有一个.clear()方法,但没有这样的运气.

有人能指出我在正确的方向吗?

RelativeLayout rel = (RelativeLayout) findViewById(R.id.iv_section);
rel.SomethingToRemoveAllChildren();
Run Code Online (Sandbox Code Playgroud)

谢谢.

Don*_*eep 12

ViewGroup.removeAllViews()