Registration screen jumping field with "Enter"

3

I made a registration screen, but when the user gives enter on the keyboard she skips a line. Can you block this? Here are the prints for a better understanding:

asked by anonymous 01.07.2016 / 16:32

2 answers

9

Put the attribute below in the EditText in question

android:singleLine="true"

EDIT

As stated, android:singleLine has been deprecated from API 3. You will have to use android:maxLines . In your case, android:maxLines="1" .

SingleLine has been discontinued because of performance issues, but will not be removed because of some effects that maxLines can not do.

For example, the code below scrolls horizontally in a line if the text is selected.

<TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:singleLine="true"
     android:ellipsize="end"
     android:scrollHorizontally="true" />

This code does not

<TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:maxLines="1"
     android:ellipsize="end"
     android:scrollHorizontally="true" />

Link for the source.

    
01.07.2016 / 16:34
4

Uses android:maxLines="1" android:singleLine has become obsolete recently

    
01.07.2016 / 19:23