开发者

android tablerow and columns in code

开发者 https://www.devze.com 2023-02-10 02:12 出处:网络
I\'m trying to create a TableLayout with dynamically added rows and columns (from an array of obbjects). Since it\'s dynamic 开发者_开发百科must I code(?)

I'm trying to create a TableLayout with dynamically added rows and columns (from an array of obbjects). Since it's dynamic 开发者_开发百科must I code(?)

All the examples I can find is doing it using xml layouts. The only ones out there that does it in code only adds a single view, like a button, which makes me believe its not doable, and I need two columns at least, where one of the will contain a view with an image and text.


Try to create table and row doing something like this

TableLayout t=new TableLayout(this);
TableRow tr=new TableRow(this);

and add row with table by

t.addView(tr);

similarly you can add other view (text, image view etc.) by using addView() function

0

精彩评论

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