How to leave the first character uppercase on the keyboard?

Asked

Viewed 1,242 times

1

How to start keyboard with uppercase letter for the user to start writing without having to tap the arrow to make the letter uppercase?

I used android:inputType="textCapCharacters" but it didn’t work out right, because he writes the whole text on one line and I don’t want that to happen

  • 1

    tries that way android:inputType="textCapSentences"

1 answer

2


Basically there are two ways to capitalize the first character on the keyboard, via XML and programmatically. See:

XML

Set up your ExitText thus using textCapWords|textCapSentences:

android:inputType="textCapWords|textCapSentences"

Programmatically

EditText editor = new EditText(this); 
editor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);

See more details in the documentation.

  • This textCapSentences works yes, but it does not break line understand? I will test this Edittext

  • 1

    @Aline made an amendment, inserting textCapWord along with textCapSentences and it worked perfect here in my application. If there are any more questions, call here.

  • It worked here....

Browser other questions tagged

You are not signed in. Login or sign up in order to post.