textview只显示大写字母

Tom*_*mmy 1 android

我有一个按钮,当点击时会混淆一个单词并将单词放入textview.

我希望textview只显示大写字母.

我怎样才能做到这一点?

谢谢.

Dee*_*oel 8

使用android:textAllCaps:true它会像魅力一样工作

 <TextView
    android:layout_width="0dip"
    android:layout_height="wrap_content"
    android:layout_weight="3"
    android:text="@string/app_name"
    android:textAllCaps="true"
    android:layout_gravity="center_vertical"
   android:textStyle="bold"
    android:typeface="sans" />
Run Code Online (Sandbox Code Playgroud)

在Java代码中使用

   text.toUpperCase() 
Run Code Online (Sandbox Code Playgroud)