This has been asked a lot of times (1, 2, 3, 4…) but that was long ago, and neither of the answers work for me now. Hence posting the new question rather than bumping the old ones. Sorry for the duplicate.
I need to have an EditText, where:
If you have Gmail or Inbox app, I need exactly the functionality of email subject field.
Here's the approximate picture — only that the keyboard should show an › button, not a caret button.
I've been trying all kinds of EditText properties and their combinations, including ones with android:inputType="textEmailSubject"
, but I always either have it single-line and not wrapping, or I have this caret button and it allows for line breaks. Another interesting fact is that I can get it to work with a non-stock keyboard (AnySoftKeyboard), but not with the stock one.
Please help
I found out you have to do this by code because some XML attributes get ignored in particular cases.
In your layout, make sure you do not set textMultiline
as input type, then use the following code:
mEditText.setMaxLines(Integer.MAX_VALUE); // Or specify a lower value if you want
mEditText.setHorizontallyScrolling(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With