我想让 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 自动换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
在android中剪切、复制、粘贴Cut, copy, paste in android(在android中剪切、复制、粘贴)
android EditText 融入背景android EditText blends into background(android EditText 融入背景)
更改 EditText 的线条颜色 - AndroidChange Line Color of EditText - Android(更改 EditText 的线条颜色 - Android)
EditText 始终显示带 2 位小数的数字EditText showing numbers with 2 decimals at all times(EditText 始终显示带 2 位小数的数字)
更改光标在展开的 EditText 中的开始位置Changing where cursor starts in an expanded EditText(更改光标在展开的 EditText 中的开始位置)
android中的EditText,adjustPan,ScrollView问题EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView问题)