1,常见类型

1 <EditText
2     android:id="@+id/email_address"
3     android:layout_width="fill_parent"
4     android:layout_height="wrap_content"
5     android:hint="@string/email_hint"
6     android:inputType="textEmailAddress" />

其中 android:inputType 用于指定键盘输入类型和回车键的行为。

text Normal text keyboard.
textEmailAddress Normal text keyboard with the @ character.
textUri Normal text keyboard with the / character.
number Basic number keypad.
phone Phone-style keypad.
date  
time  
textMultiLine  

 

2,回车键的行为

1 <EditText
2     android:id="@+id/postal_address"
3     android:layout_width="fill_parent"
4     android:layout_height="wrap_content"
5     android:hint="@string/postal_address_hint"
6     android:inputType="textPostalAddress|
7                        textCapWords|
8                        textNoSuggestions" />

 

textCapSentences Normal text keyboard that capitalizes the first letter for each new sentence. 每句首字母大写
textCapWords Normal text keyboard that capitalizes every word. Good for titles or person names. 每个单词大写
textAutoCorrect Normal text keyboard that corrects commonly misspelled words. 自动纠正一般拼写错误
textPassword Normal text keyboard, but the characters entered turn into dots. 心小黑点显示输入的内容
textMultiLine Normal text keyboard that allow users to input long strings of text that include line breaks (carriage returns). 可包含换行符等。
更多 https://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType  

相关文章:

  • 2021-09-21
  • 2022-12-23
  • 2022-02-28
  • 2022-03-11
  • 2021-10-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-08
猜你喜欢
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2021-09-28
相关资源
相似解决方案