Reputation: 3893
I know that it's possible to have an XML file with a TableLayout, and another XML file with a row. And then it's somehow possible to add rows, from the second file, with custom content in the java code to the table in the first file. But I can't find an example that shows how this is done. So, does anyone here know where I can find an example that shows this? I know that I have seen it before.
Upvotes: 1
Views: 1959
Reputation: 44919
Once you have your TableLayout
, you can inflate and add rows using:
TableRow row = (TableRow) LayoutInflater.from(this).inflate(
R.layout.table_row, tableLayout, false);
tableLayout.addView(row);
Upvotes: 0
Reputation: 200090
First results using Google. Whatever... the idea is really simple:
TableLayout
(either one declared in a XML file, or created by hand using new TableLayou(context)
)TableRow
object. Again, you can do so by using an already defined TableRow
in an XML and inflate it; or you can just created by using the new
operator.addView
method. Sometimes you will want to specify some TableRow.LayoutParams
.TableRow
to the TableLayout
.Upvotes: 2