Android的,需要在我的ListView使大写每个单词的第一个字母 [英] Android,need to make in my ListView the first letter of each word uppercase
本文介绍了Android的,需要在我的ListView使大写每个单词的第一个字母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么能得到一个ListView大写每个单词(的TextView)与字的其余字母小写??
How could i get each word(TextView) in a ListView UpperCase and the rest of the word LowerCase??
感谢您的帮助!
推荐答案
你有方法getCount将()和getView()。使用它们通过视图列表循环,然后像做:
in ListView you have methods getCount() and getView(). Using them iterate through the view list, and then do something like:
TextView view = listView.getView(...);
String txt = view.getText();
txt = String.valueOf(txt.charAt(0)).toUpperCase() + txt.substring(1, txt.length());
view.setText(txt);
不要忘记检查你修改字符串的长度。
Don't forget to check for the length of the string you modify.
这篇关于Android的,需要在我的ListView使大写每个单词的第一个字母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文