Android:capitalize Not Working
android:textAllCaps="true"
Otherwise, you'll have to implement this behavior yourself.
Solution 2:
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.
Solution 3:
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"
.
Solution 4:
This is a late answer but I think might help someone...
If you are comfortable with capitilizing the dynamic text in the java code then you can use:
textView.setText(text.toUpperCase());
Solution 5:
@Shine's answer is correct I don't know why it was down voted. android:capitalize was deprecated in API 3. Unfortunately the TextView docs fail to indicate this, the proof is burried in R.attr:
Android studio also fails to inform you that this attribute is deprecated. Another 30 mins I'll never get back, thanks google!
Post a Comment for "Android:capitalize Not Working"