Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 textPersonName 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 textCapWords 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 textPersonName as the input type?

like image 993
Mike Baxter Avatar asked Jul 02 '13 11:07

Mike Baxter


People also ask

What is inputType in android?

The android:inputType attribute allows you to specify various behaviors for the input method. Most importantly, if your text field is intended for basic text input (such as for a text message), you should enable auto spelling correction with the "textAutoCorrect" value.

What is Numbersigned?

noun. Mathematics. a number preceded by a plus sign (+) to indicate a positive quantity or by a minus sign (−) to indicate a negative quantity.

What is textWebPassword?

Text that is a password that should be visible. Corresponds to. TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_VISIBLE_PASSWORD . textWebPassword.

What is signed number in Android Studio?

TYPE_NUMBER_FLAG_SIGNED. Flag of TYPE_CLASS_NUMBER : the number is signed, allowing a positive or negative sign at the start.


2 Answers

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

http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType

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:

android:inputType="textPersonName|textCapWords" 

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

like image 122
arbitrarily Avatar answered Sep 23 '22 03:09

arbitrarily


inputype attribute in EditText widget: (tested on Android 4.4.3 and 2.3.3)

<EditText android:id="@+id/et_test" android:inputType="?????"/> 
  • inputType: textLongMessage. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: yes. Case: lowercase. Suggestion: yes. Addition chars: , and . and everything

  • inputType: textFilter. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: yes. Case: lowercase. Suggestion: no. Addition chars: , and . and everything

  • inputType: textCapWords. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: yes. Case: Camel Case. Suggestion: yes. Addition chars: , and . and everything

  • inputType: textCapSentences. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: yes. Case: Sentence case. Suggestion: yes. Addition chars: , and . and everything

  • inputType: time. Keyboard: numeric. Enter button: Send/Next. Has emotion: no. Suggestion: no. Addition chars: :

  • inputType: textMultiLine. Keyboard: alphabet/default. Enter button: nextline. Has emotion: yes. Case: lowercase. Suggestion: yes. Addition chars: , and . and everything

  • inputType: number. Keyboard: numeric. Enter button: Send/Next. Has emotion: no. Suggestion: no. Addition chars: nothing

  • inputType: textEmailAddress. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: no. Case: lowercase. Suggestion: no. Addition chars: @ and . and everything

  • inputType: (No type). Keyboard: alphabet/default. Enter button: nextline. Has emotion: yes. Case: lowercase. Suggestion: yes. Addition chars: , and . and everything

  • inputType: textPassword. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: no. Case: lowercase. Suggestion: no. Addition chars: , and . and everything

  • inputType: text. Keyboard: Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: yes. Case: lowercase. Suggestion: yes. Addition chars: , and . and everything

  • inputType: textShortMessage. Keyboard: alphabet/default. Enter button: emotion. Has emotion: yes. Case: lowercase. Suggestion: yes. Addition chars: , and . and everything

  • inputType: textUri. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: no. Case: lowercase. Suggestion: no. Addition chars: / and . and everything

  • inputType: textCapCharacters. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: yes. Case: UPPERCASE. Suggestion: yes. Addition chars: , and . and everything

  • inputType: phone. Keyboard: numeric. Enter button: Send/Next. Has emotion: no. Suggestion: no. Addition chars: *** # . - / () W P N , +**

  • inputType: textPersonName. Keyboard: alphabet/default. Enter button: Send/Next. Has emotion: yes. Case: lowercase. Suggestion: yes. Addition chars: , and . and everything

Note: Auto-capitalization setting as shown in the following screenshot will change the default behavior (True is default, textCapWords will work as expected. False will override textCapWords)

Auto-capitalization setting

Note 2: In the Numeric keyboard, ALL numbers are English 1234567890.

Note 3: Correction/Suggestion setting overrides the default behavior.

like image 41
Yousha Aleayoub Avatar answered Sep 26 '22 03:09

Yousha Aleayoub