I have two layout files, a main one containing a custom view, and a table, and a row layout.
Depending on circumstances, the table needs additional rows, inflated from the row layout like this:
TableLayout tl = (TableLayout) mParent.findViewById(R.id.table_layout);
LayoutInflater inflater = LayoutInflater.from(mParent);
TableRow tr = (TableRow) inflater.inflate(R.layout.layout_row, null);
tl.addView(tr, 0);
This works as intended.
tl.addView(tr)
This does nothing at all.
Why? I spent half an hour on this, before I tried the addView with two arguments, and I can now make this work, yet it would be better to actually understand why.
Thanks!
Stupid question. It was added, but invisible because out of the screen. Sorry about this.