If you can add it to the code, it will look like this:
EditText et = new EditText(this);
l.addView(et, new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, 100));
where 100means it will have 100dp width. l- this is Layoutone that you may have ( ScrollViewin your case) that you can get using R.layout.name_of_the_scroll_view.
I'm not sure, but try to set the height property WRAP_CONTENT.
source
share