Brian Butterfield Brian Butterfield - 1 year ago 130
Android Question

InputType = PersonName?

I have a TextView object that's purpose is to type in the name of a person. I looked at here and saw that

is an input type. So I selected that input type, thinking that it would do what I wanted.

However, this input type does not capitalize the first letter. As people's names start with capital letters, I found this to be very odd. Is this intentional, or a design oversight on Google's part?

In any case, I have selected
as the new input type to make sure every word starts capitalized. Will there be any disadvantage to using this input type for a person's name? What are the benefits of using
as the input type?

Answer Source

You can combine the inputType attributes using an | (or) operator.

The type of data being placed in a text field, used to help an input method decide how to let the user enter text. The constants here correspond to those defined by InputType. Generally you can select a single value, though some can be combined together as indicated. Setting this attribute to anything besides none also implies that the text is editable.

Must be one or more (separated by '|') of the following constant values.

So to combine the benefits of textPersonName with textCapWords, simply set the input type using this syntax:


This answer gives a brief explanation of the benefits of using textPersonName for a name entry field.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download