I want to manage the height and width of an EditText
box programmatically in Android. I tried edittext.setWidth(32);
and edittext.setEms(50);
, but both are not working. See my below code, as I am using it to create dynamic EditText
s in Android.
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;
}
works for me. for example
Try this.
Try the following code:-