开发者

Addint textview to tableview dynamically

I want to populate the android tableview's rows with an array at runtime...开发者_开发问答 How to go about it....please advise

Thanks,


You can populate table view row's by reading tables child as follows:

TableLayout x = (TableLayout) findViewById(R.id.table_id);
for(int i=0;i<x.getChildCount();i++){
   TableRow tr = (TableRow) x.getChildAt(index);
   //Do here with table row, what u want to do.
}


TableLayout layout = (TableLayout) findViewById(R.id.table);
TableRow tr = new TableRow(context);

TextView view = new TextView(context);
view.setText("Test");
tr.addView(view);
layout.addView(tr);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜