dmn*_*nlk 3 android android-layout
我的布局是这样的
<ParentLinearlayout>
<ChildLinearlayout>
<Button>
</ChildLinearlayout>
<ChildLinearlayout>
<Button>
</ChildLinearlayout>
</ParentLinearlayout1>
Run Code Online (Sandbox Code Playgroud)
ChildLinearlayout 的数量改变,动态添加和删除。
单击按钮时,我想删除作为 Button 父级的 ChildLinearlayout。
但我不知道索引线性布局。索引经常更改,因此不能使用标签。
如何知道 LinearLayout 索引?
int index = linearLayout.indexOfChild(view);
linearLayout.removeViewAt(index);
Run Code Online (Sandbox Code Playgroud)