Is it possible to use TableRow like this:
That is array of TableRows. This must be inside table layout where table layout is nested inside linear layout.
TableRow[] tr = new TableRow[dimension];
Is it possible to use TableRow like this:
That is array of TableRows. This must be inside table layout where table layout is nested inside linear layout.
TableRow[] tr = new TableRow[dimension];
Yes... this is abosutely possible in Android . TableRow is a class and you are trying to make an array of objects of a class .
Yes Absolutely Possible. check this link & try this code.
public void init(){
TableLayout ll = (TableLayout) findViewById(R.id.displayLinear);
for (int i = 0; i <2; i++) {
TableRow row= new TableRow(this);
TableRow.LayoutParams lp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT);
row.setLayoutParams(lp);
checkBox = new CheckBox(this);
tv = new TextView(this);
addBtn = new ImageButton(this);
addBtn.setImageResource(R.drawable.add);
minusBtn = new ImageButton(this);
minusBtn.setImageResource(R.drawable.minus);
qty = new TextView(this);
checkBox.setText("hello");
qty.setText("10");
row.addView(checkBox);
row.addView(minusBtn);
row.addView(qty);
row.addView(addBtn);
ll.addView(row,i);
}}
Check Answer Posted by Fredigato in that link. Hope this helps.