11 Vote

Android EditText without Line Break

Question by Guest | 2013-09-23 at 14:06

In my XML layout for an Android app, I have set a button next to an EditText control. With the button, you can handle the content of the EditText field.

Sometimes, the content of the EditText field is about 2 or 3 characters longer than it is possible limited through its width.  That would not be so bad, but in this moment, the EditText field extends down in an ugly way and the text is displayed with a line break, destroying my whole layout.

What can I do, that this transition does not occur and the text still remains in a single-line in the EditText, even if the field is not long enough for the text? 

1Best Answer1 Vote

Just add the line android:singleLine="true" to the properties of the field:

   android:text="" >

This makes the text staying in a row and it is no longer breaking.
2013-09-24 at 18:27

ReplyPositive Negative

Related Topics

PHP: Line break and strpos

Question | 1 Answer

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.


Ask your own question or write your own article on askingbox.com. That’s how it’s done.