Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is special about android:inputType="textPersonName" for EditText

Tags:

android

I tried

        <EditText
            android:id="@+id/editText1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10"
            android:inputType="textPersonName" >

I realize it can accept any characters. So, what is special having android:inputType="textPersonName", compared to not having it?

like image 267
Cheok Yan Cheng Avatar asked Jul 31 '12 01:07

Cheok Yan Cheng


People also ask

What is the EditText attribute android inputType used for?

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 the use of EditText in android?

A EditText is an overlay over TextView that configures itself to be editable. It is the predefined subclass of TextView that includes rich editing capabilities.

What are the attributes of EditText?

Android EditText Attributes It is used to change the color of the text. It is used to change the text color of hint text. It is used to specify the size of the text. It is used to change the style (bold, italic, bolditalic) of text.


2 Answers

The difference is that if you use "textPersonName", the user can not insert new lines (the enter button is not showed)

like image 164
angrymadcat Avatar answered Oct 12 '22 07:10

angrymadcat


Spelling check is not done when using android:inputType="textPersonName" but it is done in textCapWords.

So if you use textPersonName there won't be red underline for names but first letter of each name (firstname, middlename, lastname etc) won't be capitalized.

so best solution is combining both with an or that is android:inputType="textPersonName|textCapWords".

now there won't be red underline for name and first letter would be capitalized also

like image 31
Jilson Avatar answered Oct 12 '22 09:10

Jilson