In Android, for the EditText view which inputType is the best for First and Last Names?

1

Cordial greeting, for the EditText view (if the EditText is called a view?) which is the best value for the inputType attribute, for the input of First and Last Names, I want that at the beginning and always after a space the first letter is capitalized. thank you very much.

    <EditText
    android:id="@+id/etNombres"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType=""
    android:hint="@string/Nombres"/>    
    
asked by Stiven Trujillo 11.03.2018 в 15:38
source

1 answer

0

Best value for your inputType depends on the use you want to give it. In your case and through xml , one appropriate to what you are looking for would be one combined with 2 values.

  

android:inputType="textCapWords|textAutoCorrect"

     

Which is self-correcting and will put each of the first letter of each word in uppercase.

Programmatically would be done this way.

editText = (EditText)findViewById(R.id.editText);
editText.setInputType(InputType.TYPE_CLASS_TEXT
                           |InputType.TYPE_TEXT_FLAG_CAP_WORDS);
    
answered by 11.03.2018 / 18:10
source