Android: How to make an AutoCompleteTextView SingleLine?

Just add this two below lines. It will be fine.

android:imeOptions="actionNext"
android:inputType="text"

or,

android:imeOptions="actionDone"
android:inputType="text"

Set android:imeOptions="actionNext" in AutoCompleteTextView in xml .


Setting android:inputType="text" on the AutoCompleteTextView element in the layout XML worked for me; limits input to one line and the Next soft key is present. Pressing the Next soft key didn't actually advance input to the next AutoCompleteTextView in my Activity until I also added android:imeOptions="actionNext".

I couldn't find anything in the reference site to support this, but Content Assist in Eclipse seems to indicate android:singleLine is deprecated (at least in this context):

Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. * Deprecated: This attribute is deprecated. Use "maxLines" instead to change the layout of a static text, and use the "textMultiLine" flag in the inputType attribute instead for editable text views (if both singleLine and inputType are supplied, the inputType flags will override the value of singleLine). [boolean]"