Question

I have an edit text and I'd like to put the following constrains (in the XML code if possible):

  • Disable all the capital Letters (the inverse of android:capitalize or the same fonction than toLowerCase())
  • Block to EditText to 1 line max. (for instance avoid that when I press enter the editText get bigger to create a new line)

In fact , my editText is a Search Field (but in my case I don't want to use the special Search Widget).

Thanks

Was it helpful?

Solution

To make the edittext single line add this to its tag:

  android:singleLine="true"

Also android:capitalize is depreciated and the following should be used instead

  android:inputType="textCapCharacters"

However there seems to be no matching lowercase inputType, so you may have to implement it manually using a setOnKeyListener.

OTHER TIPS

use android:lines="1" in the android xml page and then see the layout.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top