我在 OnCreate() 中创建了一个动态表格布局。每次活动恢复时,表行中的数据都会发生变化,所以我想销毁表行并创建新行。我怎样才能做到这一点?谢谢!!!
这是 OnCreate 表创建部分的样子:
tableLayout tl = new TableLayout(this);
for (i = 0; i < numberOfVariables; i++) {
TableRow tr = new TableRow(this);
CheckBox cb = new CheckBox(this);
tr.addView(cb);
TextView dv = new TextView(this);
tr.addView(dv);
EditText et = new EditText(this);
tr.addView(et);
tl.addView(tr);
}
ll.addView(tl);