我查看了EditTextPreference的文档 http://developer.android.com/reference/android/preference/EditTextPreference.html
但我没能在那里找到 android:inputType 属性。那么这个代码段怎么用呢
<EditTextPreference
android:key="edit"
android:title="@string/location1"
android:summary="@string/summary1"
android:dialogTitle="@string/location1"
android:dialogMessage="@string/message"
android:inputType="text"
android:singleLine="true"
/>
同样对android:singleLine属性有疑问。
最佳答案
文档没有列出该类的属性,但 InputType
属性(以及其他 EditText
和 TextView
属性)仍然有效.仅在文中说明。另见 this related question .
EditTextPreference
documentation没有明确列出它支持的所有属性,但文本指出:
See EditText Attributes.
那里的链接不是很有用(他们可能重新组织了一些属性,但从未更新过一些链接),但这里有一个直接链接到 inputType values .作为快速总结,这些值是(截至发布时):
- 无
- 正文
- textCapCharacters
- textCapWords
- textCapSentences
- 文本自动更正
- 文本自动完成
- 文本多行
- textImeMultiLine
- textNoSuggestions
- 文本地址
- 文本电子邮件地址
- 文本邮件主题
- textShortMessage
- textLongMessage
- 文本人物姓名
- 文本邮政地址
- 文本密码
- 文本可见密码
- textWebEditText
- 文本过滤
- 文本语音
- textWebEmailAddress
- 文本网络密码
- 人数
- 数字签名
- 十进制数
- 密码
- 电话
- 日期时间
- 日期
- 时间
你显然可以使用其中的一个或多个,用 |
分隔(虽然我从来没有这样做过)。
关于android - 我们如何使用android :inputType in EditTextPreference?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31350412/