9

This will have a really simple answer, but I can't seem to find what it is. I want to disable the auto-capitalization of an EditText so that, by default, the first letter entered with not be automatically capitalized. I still want to allow capitalization, but only if the user manually does so.

I've tried android:capitalize="none" on my EditText, and I've tried android:inputType="text" but both still auto-capitalize the first letter. I don't want to use a TextWatcher because on the soft keyboard it will still show the shift key as pressed for the first letter, and I'm nit-picky and don't want that to show.

Jason Robinson
  • 31,005
  • 19
  • 77
  • 131
  • Does the auto-capitalization occurred by your current keyboard software? If it's true, disable your keyboard's auto-cap setting. – basicsharp Aug 08 '11 at 01:20

3 Answers3

23

You could try using android:inputType="none" instead.

UPDATE:

You could also try using android:inputType="text|textEmailAddress"

A. Abiri
  • 10,750
  • 4
  • 30
  • 31
  • Still auto-capitalizes. I would suspect specifying "none" would just use whatever default settings the user has on his phone. – Jason Robinson Aug 08 '11 at 15:01
  • Accepted answer should probably be changed to android:inputType="textFilter" (below.) I think something has changed recently because that was the only answer that worked for me. – steven smith Mar 17 '21 at 18:25
3

Have you tried android:inputType="textFilter"? That will disable all text filters, so there's no auto-correcting.

Brian
  • 7,955
  • 16
  • 66
  • 107
  • That's really weird, it doesn't auto-capitalize for me. Are you using just a regular EditText or did you modify it? – Brian Aug 08 '11 at 23:35
  • @Brian I have implemented EditText class to support custom type face file. Now its auto capitalizing every letter. I am ot able to fix it. Any suggestion.?? – W00di May 17 '13 at 11:35
  • I suspect something has changed recently. I tried type = none and type = text and text|textEmailAddress and none worked. android:inputType="textFilter"? did wortk however. – steven smith Mar 17 '21 at 18:23
0

For posterity, I think what you're (or more accurately, whoever finds this in the future) looking for is this table of all the options that can be used for the inputType:
https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType

In this specific case, I would recommend "text".
Just plain old text. Corresponds to TYPE_CLASS_TEXT | TYPE_TEXT_VARIATION_NORMAL.

Kaitlyn Hanrahan
  • 759
  • 6
  • 22