开发者

Dynamically adding the text view in android

I am new to android I have table layout which contains a single table row.. This row has got two text views in the first and s开发者_开发技巧econd column respectively..

Can anyone tell me how to add these two text views present inside the table row dynamically ??


provided you've set content view to layout with TableRow:

TextView tv1 = new TextView(this);
TextView tv2 = new TextView(this);
TableRow tr = (TableRow)findViewById(R.id.<your table row id>);

//apply layout params to your TextViews, set text etc...

tr.addView(tv1);
tr.addView(tv2);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜