Android笔记:EditText 为什么不能自动换行

网友投稿 1146 2022-05-28

本文转自qglaunch的文章

写了一个布局文件 即使设置了singleLine = false; 也无效,当然代码中也没对edittext做过任何处理。

1

2

3

4

5

6

7

8

9

Android笔记:EditText 为什么不能自动换行

10

11

12

最终解决方案是:inputtype 的更改

1

2

3

4

5

6

7

8

9

10

11

inputtype= “textMultiLine"

”Can be combined with text and its variations to allow multiple lines of text in the field. If this flag is not set, the text field will be constrained to a single line.

InputType总结:

android:inputType=“none”–输入普通字符

android:inputType=“text”–输入普通字符

android:inputType=“textCapCharacters”–输入普通字符

android:inputType=“textCapWords”–单词首字母大小

android:inputType=“textCapSentences”–仅第一个字母大小

android:inputType=“textAutoCorrect”–前两个自动完成

android:inputType=“textAutoComplete”–前两个自动完成

android:inputType=“textMultiLine”–多行输入

android:inputType=“textImeMultiLine”–输入法多行(不一定支持)

android:inputType=“textNoSuggestions”–不提示

android:inputType=“textUri”–URI格式

android:inputType=“textEmailAddress”–电子邮件地址格式

android:inputType=“textEmailSubject”–邮件主题格式

android:inputType=“textShortMessage”–短消息格式

android:inputType=“textLongMessage”–长消息格式

android:inputType=“textPersonName”–人名格式

android:inputType=“textPostalAddress”–邮政格式

android:inputType=“textPassword”–密码格式

android:inputType=“textVisiblePassword”–密码可见格式

android:inputType=“textWebEditText”–作为网页表单的文本格式

android:inputType=“textFilter”–文本筛选格式

android:inputType=“textPhonetic”–拼音输入格式

android:inputType=“number”–数字格式

android:inputType=“numberSigned”–有符号数字格式

android:inputType=“numberDecimal”–可以带小数点的浮点格式

android:inputType=“phone”–拨号键盘

android:inputType=“datetime”

android:inputType=“date”–日期键盘

android:inputType=“time”–时间键盘

当然还可以为EditText设置多个Inputtype

1

2

3

4

5

自己的小小总结:

当inputtype = numberSigned时 键盘上的“-”号可以使用,当inputtype = numberDecimal时 键盘上的“.”可以使用。盆友们 ,有知道当inputtype = textCapWords时 是什么效果?

Android

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:JS——70行完成五子棋布局
下一篇:069.骑士巡游
相关文章