2013-03-21 48 views
0

我如何大写TextView的所有文字androidTextView中文本的自动大小写

机器人:textAllCaps = “真”

作品ICS及以上,但不适合在较低版本。我希望在xml中执行capitalisation,而不是通过编程方式使用toUpper()

+0

请参阅http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType – 2013-03-21 08:28:19

+0

的inputType是EditText上的一个属性,而不是TextView的。 – v01d 2013-03-21 09:35:51

回答

3

使用android:inputType="textCapCharacters"

+0

inputType不适用于TextView。它只适用于EditText。我特别想要在TextView中大写文本。 – v01d 2013-03-21 09:35:14

+0

那么为什么你不通过大写的文本 – Trikaldarshi 2013-03-22 09:42:47

+0

我从光标中获取文本,并且必须在我的代码中的任何地方添加函数toUpper()。 textAllCaps适用于android 4.1。所以我想知道以前版本的xml等价物。 – v01d 2013-03-22 09:50:58