Capitalize Text in a TextView, using inputType

How to Capitalize Text in a TextView, using inputType

This will capitalize all characters as the user types the characters.

1. Create an Android project, if you don't already have one.

2. Add a TextView.

3. In the main.xml file, add the below line

  <TextView
    ....
      android:inputType = "textCapCharacters"
  />
 
4. To capitalize:

- the first word of each sentence - use:  
android:inputType = "textCapSentences"
- the first letter of every word - use: 
android:inputType = "textCapWords"
- every characters - use: 
android:inputType = "textCapCharacters"

5. Compile and run!

Related Articles

Resources: