Skip to content Skip to sidebar Skip to footer

Android Keyboard - Start Lowercase

Is it possible to start android keyboard with lowercase when I click on EditText? Basically, what I want is to lowercase the first letter in EditText, but also to give user an poss

Solution 1:

Yes that is possible. Try researching the EditText Input Types.

For example you force the keyboard default state as lower case by simply:

EditText text = new EditText(context);
text.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE);

Or if you want to force capitalization for every sentense:

EditText text = new EditText(context);
text.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

You can find a whole list types here.

Solution 2:

Using xml you can force keyboard to make lowercase

android:inputType="text|textEmailAddress"

Solution 3:

As this page says: Initial keyboard on lowercase

Set input type to email addres:

Text.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

Solution 4:

Using

text.setInputType(text.InputType.TYPE_CLASS_TEXT | text.InputType.TYPE_TEXT_FLAG_MULTI_LINE);

or

text.setInputType(text.InputType.TYPE_CLASS_TEXT | text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);

Did not work for me. What actually did it was this:

text.setInputType(inputEditText.getInputType() | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS); // forced capitalization
text.setInputType(inputEditText.getInputType() & ~ InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS); // negate the flag

Post a Comment for "Android Keyboard - Start Lowercase"