我尝试使用以下方法删除tableLayout中的行:
table.RemoveAllViews()
table.RemoveAllViewInLayout()
table.RemoveViewAt()
但它没有用。
我的所有行都是动态添加的。
感谢您的帮助。
答案 0 :(得分:1)
如果要清除所有表格,可以使用以下方法在 循环中逐个删除表格子项:
int count = table.getChildCount();
for (int i = 0; i < count; i++) {
View child = table.getChildAt(i);
table.removeView(child);
}