EditText 自动换行 [英] EditText automatically go to a new line

查看:24
本文介绍了EditText 自动换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让 EditText 的最大行数为 2,最大长度为 20.如果 EditText 长度超过 10,它应该会自动转到一个新的行,因此用户无需按 Enter.有人可以帮我解决这个要求吗?

I want to make the EditText with max lines of 2 and max length of 20. If the EditText length is more than 10, it should automatically go to a new line so the user don't need to press Enter. Can someone help me with this requirement?

推荐答案

将此添加到您的 EditText xml 代码中

android:inputType="textMultiLine"

android:inputType="textMultiLine"

这将在输入数据时自动将您的文本移动到下一行.

This will automatically moves your text to next line while entering data.

这篇关于EditText 自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆