我需要自动大写化合物名称中的首字母,例如:Gay-Lussac(法国物理学家),Иванов-Вано(俄罗斯动画导演)。自动大写化合物名称中的第一个字母(EditText,Android)
Android EditText仅首字母大写全名,我得到了Gay-lussac和Иванов-вано。
有什么方法吗?
我的EditText是
<EditText
android:id="@+id/nameET"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="31dp"
android:hint="@string/hint_name"
android:imeOptions="actionNext"
android:inputType="textCapWords|textCapSentences|textPersonName"
android:singleLine="true" />
我也试过(也不会为第二部分工作):
<EditText
...
android:capitalize="words"
android:singleLine="true" />
和
<EditText
...
android:capitalize="words"
android:inputType="textCapWords|textCapSentences"
android:singleLine="true" />
@LieRyan我不确定。 ' - '字符后,我需要把名字的第二部分大写。建议的解决方案只能在首字母,空格之后或字段开始处大写。我做错了什么? – tse