我有这个动态表格布局:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TableLayout
android:id="@+id/main_table"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dip"
android:layout_weight="1"
android:stretchColumns="1" >
</TableLayout>
</LinearLayout>
和代码:
tl = (TableLayout) findViewById(R.id.main_table);
...
// Create 5 columns to add as table data
TextView labelid = new TextView(this);
labelid.setId(count);
labelid.setTextSize(20);
labelid.setPadding(10, 10, 10, 10);
labelid.setGravity(Gravity.CENTER);
labelid.setText(readxml.getID() + " ");
labelid.setTextColor(Color.BLACK);
tr.addView(labelid);
// Create 5 columns to add as table data
TextView labelname = new TextView(this);
labelname.setId(count);
labelname.setTextSize(20);
labelname.setPadding(10, 10, 10, 10);
labelname.setGravity(Gravity.CENTER);
labelname.setText(readxml.getName() + " ");
labelname.setTextColor(Color.BLACK);
tr.addView(labelname);
那么,如何更新 1 行 textviews 文本?