问题
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