Is there a way to create a multi-line EditText in an AlertDialog in Android . I set setLines and it displays a larger EditText for multiple lines. but when I type, it does not go to the next line and still prints on the same line . Here is my code.
Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Comment");
final EditText input = new EditText(this);
final String item_value = ItemList.get(position).get("comment");
input.setText(item_value);
input.setInputType(InputType.TYPE_CLASS_TEXT);
input.setLines(5);
input.setMaxLines(5);
input.setGravity(Gravity.LEFT | Gravity.TOP);
builder.setView(input);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
builder.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
and my dialog box looks like this: 
since i can fix it. Thank you and welcome.
source
share