Registration screen skipping field with "Enter"

Asked

Viewed 639 times

3

I made a registration screen, but when the user gives enter on the keyboard it skips a line. Is there any way to block this ? Follow the prints for better understanding:

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui


2 answers

9


Put the attribute below in the EditText in question

android:singleLine="true"

EDIT

As stated, the android:singleLine was discontinued from API 3. You will have to use android:maxLines. In your case, android:maxLines="1".

singleLine has been discontinued for performance reasons, but will not be removed due to some effects maxLines can’t do.

For example, the code below a horizontal scrollable text in a row, 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" />

That code does not

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

Link to the source.

4

Usa android:maxLines="1" the android:singleLine has recently become obsolete

  • it has been depreciated in API 3, if I’m not mistaken. But it is still usual for some effects that cannot be achieved with maxLines or minLines.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.