android:capitalize not working
If you're targeting API Level 14 and above, you should use
android:textAllCaps="true"
Otherwise, you'll have to implement this behavior yourself.
capitalize
is basically just a KeyListener
that you can set in XML, so it only applies to text input by the user. As the documentation states (emphasis mine):
If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types.
There is a related question on how to capitalize the first letter of every word in Java which has some helpful answers.
android:capitalize
is now deprecated.
Instead of using android:capitalize="words"
, you should consider using android:inputType="textCapWords"
.
Depending on your needs, you can also use multiple values, such as android:inputType="textCapWords|textPersonName"
.