Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set the layout margins of edit text boxes?
    text
    copied!<p>In the table layout i have a tablerow and in that tablerow i have 6 edit text boxes and i want to set the layout margins for that 6 edit text boxes </p> <pre><code>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); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload