开发者

Android TextView

开发者 https://www.devze.com 2023-03-02 13:56 出处:网络
I have created tablelayout and in that tablelayout m 开发者_如何学JAVAadding row dynamically. at the same time m adding four TextView in rows dynamically. the TextView size varies. my question is how

I have created tablelayout and in that tablelayout m 开发者_如何学JAVAadding row dynamically. at the same time m adding four TextView in rows dynamically. the TextView size varies. my question is how to set height of a TextView accordingly. i.e if size of one TextView increases accordingly adjust that particular row height. Please help me.


the following few steps might help u.

1) set the table row width as fill_parent & height as wrap_content. 2) add these four textview in order in which u want to display on ui.

e.g

tablerow.addview(textView1,LayoutParams.wrap_content,LayoutParams.wrap_content);
  tablerow.addview(textView2,LayoutParams.wrap_content,LayoutParams.wrap_content);
  tablerow.addview(textView3,LayoutParams.wrap_content,LayoutParams.wrap_content);
  tablerow.addview(textView4,LayoutParams.wrap_content,LayoutParams.wrap_content);

& finally

table.addView(tablerow,LayoutParams.FILL_PARENT,LayoutParams.wrap_content));
0

精彩评论

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