Android设置文本框单行多行显示
16lz
2021-01-23
android:singleLine
Since: API LevelConstrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key. Note: for editable text views, it is better to control this using the textMultiLine flag in the inputType attribute. (If both singleLine and inputType are supplied, the inputType flags will override the value of singleLine.)
从单行变为显示多行时,根据api说明,最好用android:inputType="textMultiLine "来设置。
在java中用以下方法设置为多行显示:
editNames.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE|InputType.TYPE_CLASS_TEXT);
更多相关文章
- android绑定服务方法使用
- Android学习札记18:Drawable中的setDither()方法
- Android 获取WIFI MAC地址的方法
- Android键盘自适应方法.
- Android的布局方法
- 修改android 睡眠的时间的两种方法