Reputation: 1474
Iam trying to create a table with borders using TableLayout. If I add static rows in xml file i am able to see the borders. But the problem arises if I try to add some dynamic rows. Data for the table comes dynamically. Can anyone help in solving this problem. If possible please provide the source code(.java file and .xml file).
Upvotes: 1
Views: 2675
Reputation: 40401
You can create a rectangle image to use as a background for the row. TableRow
extends View
, so this should work (untested).
TableRow row = new TableRow (this);
row.setBackgroundResource (android.R.drawable.edit_text);
// rest of your code
If it doesn't work, the (tested) solution is to add a color background to the table and padding to the row.
Upvotes: 1