TextView.setAllCaps() equivalent in API older than 14?

怎甘沉沦 提交于 2020-01-05 08:35:13

问题


TextView.setAllCaps() started as of API 14. What is its equivalent for older APIs (e.g. 13 and lowers)?

I cannot find such method on lower APIs. Is maybe setTransformationMethod() responsible for this on older APIs? If yes, how should I use it? TextView.setTransformationMethod(new TransformationMethod() {... is a bit confusing.


回答1:


Try this:

textView.setText(textToBeSet.toUpperCase());



回答2:


What about oldskool strtoupper()?




回答3:


Bottom line is that toUpperCase() is the solution. I can't object that. If you prefer doing the setAllCaps() with TransformationMethod, take a look at my answer.



来源:https://stackoverflow.com/questions/13540903/textview-setallcaps-equivalent-in-api-older-than-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!