如何删除在Android的表格布局表行 [英] how to delete table row in table layout in android
本文介绍了如何删除在Android的表格布局表行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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...
感谢名单..
推荐答案
尝试<一href="http://developer.android.com/reference/android/view/ViewGroup.html#removeView%28android.view.View%29">removeView
row = (TableRow)findViewById(R.id.row);
table.removeView(row);
这篇关于如何删除在Android的表格布局表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文