当我点击 EditText 时是否可以用小写字母启动 android 键盘?基本上,我想要的是小写 EditText 中的第一个字母,但也让用户可以根据需要将其变为大写...
Is it possible to start android keyboard with lowercase when I click on EditText? Basically, what I want is to lowercase the first letter in EditText, but also to give user an possibility to make it uppercase if he want...
(EditText 输入是并且必须是多行文本)
(EditText input is and must be multiline text)
<EditText
android:id="@+id/txt_str"
android:inputType="text|textMultiLine"
android:maxLines="1"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:hint="@string/enter_txt_here"
android:textIsSelectable="true"
android:layout_marginRight="6dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:textSize="17sp"
android:textColor="#FFFFFF"
android:textColorHint="#FFFFFF"
android:gravity="center_vertical"
android:background="@drawable/txt_card_selector"
android:ellipsize="start" />
EDIT2
我认为当文本必须是多行时这是不可能的......
EDIT2
I think this is not possible when text must be multiline...
是的,这是可能的.尝试研究 EditText 输入类型.
Yes that is possible. Try researching the EditText Input Types.
例如,您可以通过以下方式强制键盘默认状态为小写:
For example you force the keyboard default state as lower case by simply:
EditText text = new EditText(context);
text.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_FLAG_MULTI_LINE);
或者如果你想强制每个句子都大写:
Or if you want to force capitalization for every sentense:
EditText text = new EditText(context);
text.setInputType(android.text.InputType.TYPE_CLASS_TEXT | android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
您可以在这里找到完整的列表类型.
You can find a whole list types here.
这篇关于Android 键盘 - 开始小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!