0

请给我一个建议,我想做一个包含混合元素的动态布局[文本] [复选框] [按钮] [文本] [复选框] [按钮] [文本] [复选框] [按钮] ......

你能给我一些示例代码吗?

4

1 回答 1

2
final TableLayout Tlayout = new TableLayout(getApplicationContext());  
Trow = new TableRow(getApplicationContext()); 

checkBox = new CheckBox(getApplicationContext());
Trow.addView(checkBox);

button = new Button(getApplicationContext());
button.setText("Button");
Trow.addView(button);

textBox = new EditText(getApplicationContext());
textBox.setText("default_value");
Trow.addView(textBox);

Tlayout.addView(Trow);

此代码可以帮助您创建动态表单元素。

于 2010-06-09T06:49:34.483 回答