开发者

Dynamically adding the text view in android

开发者 https://www.devze.com 2023-04-12 22:47 出处:网络
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..

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

精彩评论

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

关注公众号