Reputation: 2642
I have a List of TableLayout's that are each generated from data in my database. I need to loop through this list and add each TableLayout to my LinearLayout.
Below is the code I currently have, however it looks like each time the table is added, it is replacing the last one so the end result is the app displaying only the last table in the list (as far as I can tell)
container = (LinearLayout) findViewById(R.id.container);
for (int i = 0; i < listOfTables.size(); i++) {
container.addView(listOfTables.get(i), i);
}
Any ideas? Max.
Upvotes: 2
Views: 523
Reputation: 12375
You need to play with the XML height and width attributes, in all likelihood.
Try changing the layout-height
and layout-width
attributes for the table layouts and the linear layout to wrap_content
and see what that does :)
You might also try changing the code so it doesn't have the 2nd argument. It should add the layouts linearly.
Hope this helped!
Upvotes: 1