0

Wondering how is it possible to show "new line" / "enter" action button while setting the Input Text View to be singleLine="true"

That "enter" action button shows only when its not a singleLine="false"

Also, I don't want to set the input as multiple lines / max lines > 1 and then to "catch" the enter event in code and that to prevent it from breaking a line in the input

its not about the keyboad, but about the behavior that is provided to user when he handles a multi line input (user can break a line / enter) , and I want to provide that functionality (look like that functionality is available) even though its not a multi line input

Daniel
  • 36,833
  • 10
  • 119
  • 200
  • Try to set `android:imeOptions="actionNext"` for your EditText. And `singleLine` is deprecated, instead, you need to use `android:maxLines="1"` – punchman Oct 30 '18 at 21:56

1 Answers1

0

That's entirely up to the keyboard. The keyboard, which is a separate app and there's hundreds of on the play store, gets to decide what buttons it has. There is no way to ensure that a particular button is used on any keyboard, and hacking settings to find something that works on one could break it on others.

Gabe Sechan
  • 90,003
  • 9
  • 87
  • 127
  • I'm referring to the default keyboard only, and anyway even if on "that other separate app" the "enter" icon will look differently it will still be recognized by the user as "enter" key icon – Daniel Oct 30 '18 at 22:31
  • What's the default keyboard? Every oem has their own – Gabe Sechan Oct 30 '18 at 22:33
  • And even if you mean on one specific default keyboard, or can be version specific. There is no api for what you want, it can and will break at any time. – Gabe Sechan Oct 30 '18 at 22:35
  • its not about the keyboad, but about the behavior that is provided to user when he handles a multi line input (user can break a line / enter) , and I want to provide that functionality (look like that functionality is available) even though its not a multi line input – Daniel Oct 30 '18 at 22:50
  • Then you'd need to add an action listener and enter the new line when it's fired. That should make the action button behave like enter on any non exotic keyboard – Gabe Sechan Oct 30 '18 at 22:54
  • Then I think you aren't explaining it well. At first it sounded like you wanted to control what keys were on the keyboard, then it sounded like you wanted to force the action key to insert new lines. If you want some third thing, you need to be clearer – Gabe Sechan Oct 31 '18 at 07:54
  • Might be :| , I want my edit text to be single line and when keyboard is being displayed I want the action button (imeOptions) to show the enter key (this key displayed by default only when working with multi line edit text) https://www.iconfinder.com/icons/214651/arrow_enter_icon – Daniel Oct 31 '18 at 08:07