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,999
  • 5
  • 51
  • 61

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,404
  • 6
  • 37
  • 66
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,126
  • 1
  • 23
  • 39
2

use this one

android:inputType="textCapSentences"

my be this will work

android:capitalize="words"

more detail Here

Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50