I am building a text area in my APP using a TextInputLayout
and its multiline property to let the users write more than 1 line, I am building it programatically (no xml)
TextInputLayout textInputLayout = new TextInputLayout(context);
textInputLayout.setLayoutParams(new TextInputLayout.LayoutParams(TextInputLayout.LayoutParams.MATCH_PARENT, TextInputLayout.LayoutParams.WRAP_CONTENT));
TextInputEditText field = new TextInputEditText(context);
field.setText(text);
field.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
field.setLayoutParams(new TextInputLayout.LayoutParams(TextInputLayout.LayoutParams.MATCH_PARENT,(int) (100 * dp)));
textInputLayout.addView(field);
myLinearLayout.addView(textInputLayout); // add text to layout
The code above makes my textarea, but is not showing the line break
button, it shows a submit
button instead.
This is the current result:
This is the expected result (from another app):
Which property I have to add to show the line break button like the second image?
How to get the keyboard to show a return key?
Try setting IMEOptions as None.
field.setImeOptions(EditorInfo.IME_ACTION_NONE);
Also check if the EditText has become SingleLine that also causes the done button to appear.