如何清除一个TableLayout所有行? [英] How to clear all rows from a TableLayout?

查看:555
本文介绍了如何清除一个TableLayout所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,这已经被问过,但没有其他答复中曾经帮助过我,所以我会问我自己...

I know that this has already been asked before, but none of the other responses have helped me, so I'll ask myself...

我想从一个TableLayout删除我的所有现有行,因为我希望用户能够动态地更新表。其他建议还使用removeAllViews(),这是应该删除所有孩子的意见建议,但是这个删除行从我的其他表在同一的LinearLayout(我有一个具有多个表的线性布局)。

I am trying to delete all my existing rows from a TableLayout because I want the user to be able to update the table dynamically. Other suggestions have recommended using removeAllViews(), which is supposed to remove all child views, however this deletes rows from my other tables in the same LinearLayout (I have a linear layout with multiple tables).

有什么建议?

推荐答案

这听起来像你可能会调用 removeAllViews()对整个的LinearLayout ,而不是特定的 TableLayout 要清除。仔细检查你有一些事情一样:

It sounds like you might be calling removeAllViews() on the whole LinearLayout and not the particular TableLayout you want to clear. Double check you have some thing like:

myLinearLayout.someTableView.removeAllViews()

这篇关于如何清除一个TableLayout所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆