title: How to set EditText box height and width programmatically in Android
body: <p>I want to manage the height and width of an <code>EditText</code> box programmatically in Android. I tried <code>edittext.setWidth(32);</code> and <code>edittext.setEms(50);</code>, but both are not working. See my below code, as I am using it to create dynamic <code>EditText</code>s in Android.</p>
  
  <pre><code>private EditText createEditText()
  {
      final LayoutParams lparams = new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
      final EditText edittext = new EditText(this);
      edittext.setLayoutParams(lparams);
      edittext.setWidth(32);
      edittext.setEms(50);
      return edittext;
  }
  </code></pre>