如何删除在Android的表格布局表行表格、布局、Android

2023-09-04 23:59:51 作者:欲望·深入骨髓

void init()
{
   intcolumnwidth1 = int_scr_wd*55;
   intcolumnwidth1 = intcolumnwidth1/100;
   for (int i = 0; i < strarr.length-1; i++)
   {
      strinarr = fun1.split(strarr[i].trim(),"^");
      tr1 = (TableRow) new TableRow(this);
      txt1=new TextView(this);
      txt1.setWidth(intcolumnwidth1);
      txt1.setText(strinarr[0]);
      tr1.addView(txt1);
      tl.addView(tr1,new TableLayout.LayoutParams(layoutParams));
   }
}

情景是这样的,当为第i打开这个页面是动态地将表中的行布局...但如果​​以后在数据库更改了一段时间的数据... ...当我点击刷新按钮,追加后的新数据在表格布局旧数据......所有我需要的是如何刷新或删除的TextView已经存在于表中的布局解决方案...

Scenario is this when for the first i open this page it dynamically adds rows in the table layout ... but if after some time data in database changes ... when i click on refresh button it appends the new data after the old data in the table layout... all i need is the solution for how to refresh or delete textview that already exists in the table layout...

感谢名单..

推荐答案

尝试removeView

row = (TableRow)findViewById(R.id.row);
table.removeView(row);