1
A
回答
-2
如果你的意思是你想TextView的大寫被放入它的一切,那麼你可以設置TextView的利用的XML屬性。
如果你的意思,你只需要大寫字母露面前:「您好」
- > 「HT」
然後,你需要的Java代碼一點點(從內存中,未經測試):
private static String removeLowercase(String input)
{
if(input == null)
return null;
String retVal = "";
for(int i=0; i < input.length(); i++)
{
char c = input.charAt(i);
if(Character.isUpperCase(c))
retVal += c;
}
return retVal;
}
然後,您可以設置TextView的文本:
myTV.setText(removeLowercase("SomeInput"));
2
這將文本轉換爲大寫
text.toUpperCase()
+0
謝謝,但沒有爲ArrayList
8
使用Android:textAllCaps:真的,那會像一個魅力
<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" />
在Java代碼中使用
text.toUpperCase()
相關問題
- 1. python首字母大寫只有大寫
- 2. 如何顯示小寫字母和大寫字母
- 3. 大寫首字母只
- 4. 如何讓文本框只顯示大寫字母?
- 5. 字體小寫字母,只是較小的大寫字母
- 6. 只允許大寫字母和小寫字母
- 7. 的首字母大寫只有大寫第一個字的f.label
- 8. PHP preg_replace()只留下大寫字母
- 9. 大寫字母的字符串的第一個字母只
- 10. 大寫字母和小寫字母
- 11. 正則表達式只有字母一個大寫字母
- 12. 大寫字母,小寫字母,大寫的Ant屬性
- 13. 自定義字體不以大寫字母顯示diaeresis
- 14. 只識別帶有大寫字母和小寫字母的字符串
- 15. X86 NASM將大寫字母轉換爲大寫字母和小寫字母
- 16. php大寫字母大寫字
- 17. 首字母大寫的字符串首字母大寫
- 18. 首字母大寫
- 19. 以大寫字母
- 20. 用大寫字母
- 21. 大寫首字母
- 22. 如何小寫字母轉換爲大寫字母和大寫字母爲小寫字母
- 23. 大寫小寫字母
- 24. 顯示第一個字母只
- 25. PHPEXCEL:php excel只顯示1個字母
- 26. Bootstrap Typeahead只顯示第一個字母
- 27. Bootstrap Typeahead只顯示第一個字母
- 28. 球衣只顯示字母'GET'
- 29. 帶有大寫字母的大寫字母筆畫
- 30. 用小寫字母寫成小寫字母大寫
謝謝,我試過這個,但是當我將它添加到像這樣的jumble.setText((removeLowercase(wordJ.toString())))這樣的混亂的單詞函數中時,這似乎不起作用;使編輯文本更容易只有大寫字母? – Tommy 2011-03-09 02:38:12
不用擔心,我設法通過使用android:inputType =「textCapCharacters」來完成此操作。但是你的代碼有助於從混亂的詞中刪除[]。謝謝:) – Tommy 2011-03-09 02:54:14