Set upper case for TextView
Kotlin:
textView.isAllCaps = true
use this for programatically like textView.setAllCaps(false)
for as it is and textView.setAllCaps(true)
for Uppercase
android:textAllCaps="true"
for XML Layout
In the layout XML, you can set the android:textAllCaps
attribute on your TextView
:
<TextView android:textAllCaps="true"></TextView>
Use String
class method while setting the text to TextView
as
tv.setText(strings.toUpperCase());
Have a look at this post for detail discussion.
EDIT: This was answered way back before API 14. As other answer mentioned here, textView.isAllCaps = true
and its java methods were introduced from TextView
. Please use those.