在表格佈局我有一個tablerow的,並在tablerow的我有6個編輯的文本框,我想設置佈局利潤率爲6編輯文本框如何設置編輯文本框的佈局邊距?
TableLayout t1=(TableLayout)findViewById(R.id.table_layout01);
TableRow tr1=new TableRow(inventory.this);
tr1.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
tr1.setBackgroundColor(Color.BLACK);
EditText ed6=new EditText(inventory.this);
//ed6.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
/*ViewGroup.MarginLayoutParams editmargin=new ViewGroup.MarginLayoutParams(ViewGroup.MarginLayoutParams.FILL_PARENT,ViewGroup.MarginLayoutParams.WRAP_CONTENT);
editmargin.setMargins(leftMargin, rightMargin, topMargin, bottomMargin);*/
ed6.setTextColor(Color.BLACK);
ed6.setBackgroundColor(Color.WHITE);
ed6.setText("1");
tr1.addView(ed6);
EditText ed7=new EditText(inventory.this);
//ed7.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
ed7.setTextColor(Color.BLACK);
ed7.setBackgroundColor(Color.WHITE);
ed7.setText("2");
tr1.addView(ed7);
EditText ed8=new EditText(inventory.this);
//ed8.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
ed8.setTextColor(Color.BLACK);
ed8.setBackgroundColor(Color.WHITE);
ed8.setText("3");
tr1.addView(ed8);
EditText ed9=new EditText(inventory.this);
//ed9.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
ed9.setTextColor(Color.BLACK);
ed9.setBackgroundColor(Color.WHITE);
ed9.setText("4");
tr1.addView(ed9);
EditText ed10=new EditText(inventory.this);
//ed10.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
ed10.setTextColor(Color.BLACK);
ed10.setText("5");
ed10.setBackgroundColor(Color.WHITE);
tr1.addView(ed10);
EditText ed11=new EditText(inventory.this);
//ed11.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
ed11.setTextColor(Color.BLACK);
ed11.setText("6");
ed11.setBackgroundColor(Color.WHITE);
tr1.addView(ed11);
t1.addView(tr1);
日Thnx您的答覆先生......但它不工作 – Arun 2011-01-27 10:44:55