我正在开发一些基于 web 服务的 android 应用程序...我想在我的应用程序中显示下面的类型表视图..我该怎么办?
动态表格布局代码
for (int i = 0; i < 1; i++) {
final LinearLayout linear = new LinearLayout(
FifthActivity.this);
MainLayout.setWeightSum(1.0f);
TableRow row1 = new TableRow(FifthActivity.this);
row1.setId(1000 + sCount);
TextView text1 = new TextView(FifthActivity.this);
text1.setText(button.getText());
final Button button = new Button(FifthActivity.this);
EditText e = new EditText(FifthActivity.this);
e.setWidth(20);
e.setHeight(20);
button.setText(" X ");
button.setWidth(20);
button.setHeight(20);
button.setId(2000 + sCount);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
MainLayout.removeView(findViewById(v
.getId() - 1000));
}
});
sCount++;
row1.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, 0, 0.25f));
row1.addView(text1);
row1.addView(e);
row1.addView(button);
MainLayout.addView(row1);
}
ll.addView(MainLayout);
// TODO Auto-generated method stub
这是输出
我怎样才能将此表格列对齐为视图格式....请任何人帮助我....提前谢谢.....