gpt4 book ai didi

android - 如何在android中删除表格布局中的表格行

转载 作者:可可西里 更新时间:2023-11-01 19:08:45 25 4
gpt4 key购买 nike

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));
}
}

场景是这样的,当我第一次打开这个页面时,它会在表格布局中动态添加行......但是如果一段时间后数据库中的数据发生变化......当我点击刷新按钮时它会在表格布局中的旧数据...我需要的是如何刷新或删除表格布局中已存在的 textview 的解决方案...

谢谢..

最佳答案

尝试 removeView

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

关于android - 如何在android中删除表格布局中的表格行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5553556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com