开发者

Can we create tables with borders dynamically in Android

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(.ja开发者_开发百科va file and .xml file).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜