views:

18

answers:

1

Hello, 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

A: 

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.

stealthcopter
Allright, thanks a lot !
Trox