I have a tablelayout in which each row consists of three textviews. I don't know the number of rows so I can't set the height of the textviews from the XML layout and I need to do that programmatically. The next code displays the textviews but not in proper height.. how to do that programmatically in the code?
TableRow row= new TableRow(this);
TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
row.setLayoutParams(lp);
row.setGravity(Gravity.CENTER);
tv1 =new TextView(this);
tv2 =new TextView(this);
tv3 =new TextView(this);
tv1.setText(a);
tv2.setText(b);
tv3.setText(c);
row.addView(tv1,0);
row.addView(tv2,1);
row.addView(tv3,2);
tablelayout.addView(row);