2

When I'm pressing "enter" on the keyboard, the EditText space is creating a new line and raising the space of EditText, disturbing my app layout. How can I stop this?

Thanks!

Mekillerow
  • 65
  • 3
  • 9
  • 1
    You could set the EditText to single line in the XML. What do you want to happen instead? – OneCricketeer Sep 18 '16 at 22:09
  • Are you looking for this? http://stackoverflow.com/questions/3019965/keycode-enter-to-next-edittext – OneCricketeer Sep 18 '16 at 22:10
  • [use-enter-key-on-softkeyboard-instead-of-clicking-button](http://stackoverflow.com/questions/4451374/use-enter-key-on-softkeyboard-instead-of-clicking-button) – Ninja Sep 18 '16 at 22:15

3 Answers3

4

These 3 flags will solve your issue. Add them to your edit text view.

android:inputType="text"
android:imeOptions="actionNext"
android:maxLines="1"
Shmuel
  • 3,916
  • 2
  • 27
  • 45
3

Try this when using TextInputEditText

android:inputType="text"
android:maxLines="1"
Vinay John
  • 990
  • 12
  • 13
2

Make sure you set the attribute inputType of the EditText to text like

android:inputType="text"