Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating multiline Edit view in android with coding

I have created an EditText object dynamically but I haven't been able to create a multi-line EditText. I have tried this:

EditText et1 = new EditText(this);
et1.setHint("Enter Your Address");
et1.setSingleLine(false);
et1.setHorizontalScrollBarEnabled(false);
et1.setInputType(android.text.InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS);
et1.setLines(7);

Thanks.

like image 259
Mahi Mali Avatar asked Dec 06 '25 20:12

Mahi Mali


1 Answers

Include this in your code:

    et1.setMaxLines(maxlines);

Or you can set the specific height for the edit text.

like image 136
AndroGeek Avatar answered Dec 09 '25 21:12

AndroGeek



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!