2

I want that each word should start with capital letter in an Edittext.For example:-

john smith should be write as John Smith How can i achieve this?

Deepak Sharma
  • 4,811
  • 5
  • 47
  • 60

4 Answers4

5

set android:inputType="textCapWords" to your edittext xml.

Madhu
  • 298
  • 1
  • 12
4

You can use

android:inputType="textCapWords" 

to capitalize each word

momo
  • 3,315
  • 6
  • 35
  • 63
2

Try something like this

Set android:inputType="textCapSentences" on your EditText.

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

programatically should be like this...

EditText etValue = new EditText(this);
etValue.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
Aravin
  • 4,130
  • 1
  • 21
  • 39
2

use this one

android:inputType="textCapSentences"

my be this will work

android:capitalize="words"

more detail Here

Sunil Kumar
  • 7,083
  • 4
  • 31
  • 50