【发布时间】:2011-07-08 05:24:05
【问题描述】:
我在 sqllite 中有某些数据,它每次都会更新,我点击保存按钮,我想将数据显示到表格布局中,以便为更新的数据添加更多行。
我有某些代码,但它只显示更新的数据替换以前的数据,我想在数据更新时添加更多行。
我知道这只是在表格布局中添加一行,但是如何添加更多行?
TableLayout tl=(TableLayout)findViewById(R.id.maintable);
TableRow tr1 = new TableRow(this);
tr1.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
TextView textview = new TextView(this);
textview.setText(data);
//textview.getTextColors(R.color.)
textview.setTextColor(Color.YELLOW);
tr1.addView(textview);
tl.addView(tr1, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
【问题讨论】:
标签: android