我需要把xml本身的text="font roboto regular"改成Font Roboto Regular,怎么办?
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="18sp"
android:textColor="@android:color/black"
android:fontFamily="roboto-regular"
android:text="font roboto regular"
android:inputType="textCapWords"
android:capitalize="words"/>
最佳答案
如果有人在寻找 kotlin
这样做的方式,那么代码就变得非常简单和美观了。
yourTextView.text = yourText.split(' ').joinToString(" ") { it.capitalize() }
关于android - 如何在Textview xml中将每个单词的第一个字母更改为大写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35177726/