Android设置文本框单行多行显示
16lz
2021-12-04
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 ViewFlipper
- Android在Button按钮上同时显示文字和图片
- android核心技术之性能分析工具Systrace
- ANDROID视图空间代码
- android的ListView显示
- Android(安卓)EditView属性详细介绍
- android EditText彻底搞定输入框隐藏/显示背景 可编辑输入问题
- 【Android】注解框架(二)-- 基础知识(Java注解)& 运行时注解框架
- Android之Adapter用法总结