tags:

views:

81

answers:

1

I try to add a table layout from Java code. When there are two fields in a tablerow it displays the first field only. How to display the entire row with all fields?

  .....
  ....
  for(int idx=0;idx<4;idx++){
      TableRow tbrow   = new TableRow(this);

      TextView text_v1 = new TextView(this);
      text_v1.setText("TextView");

      TextView text_v2 = new TextView(this);
      text_v2.setText(" Idx : "+idx);

      tbrow.addView(text_v1);
      tbrow.addView(text_v2);

      linearlayout.addView(tbrow);
  }
  .........
      ........

How to do this?

A: 

This offers a way of doing things. I think you want to add TableRows to a TableLayout, not directly to the LinearLayout.

Dan