TextView.setAllCaps() 等效于 14 的 API



TextView.setAllCaps() 从 API 14 开始。对于较旧的 API(例如 13 及更低版本),它的等效项是什么?

我在较低的 API 上找不到这样的方法。也许 setTransformationMethod() 在较旧的 API 上对此负责吗?如果是,我应该如何使用它? TextView.setTransformationMethod(new TransformationMethod() {...有点令人困惑。

试试这个:

textView.setText(textToBeSet.toUpperCase());

oldskool strtoupper()呢?

底线是toUpperCase()是解决方案。我不能反对。如果你更喜欢和TransformationMethod一起做setAllCaps(),看看我的答案。

最新更新