EditText maxLines 不起作用 - 用户仍然可以输入比设置更多的行 [英] EditText maxLines not working - user can still input more lines than set

查看:22
本文介绍了EditText maxLines 不起作用 - 用户仍然可以输入比设置更多的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<EditText 
    android:id="@+id/editText2" 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:maxLines="5" 
    android:lines="5">
</EditText>

用户可以输入超过 5 行,按回车/下一行键.如何使用 EditText 将用户输入限制为固定数量的行?

User can input more than 5 lines, by pressing enter/next row key. How can I limit user input to fixed amount of rows with EditText?

推荐答案

属性maxLines对应EditText的最大高度,它控制外边界而不是内部文本行.

The attribute maxLines corresponds to the maximum height of the EditText, it controls the outer boundaries and not inner text lines.

这篇关于EditText maxLines 不起作用 - 用户仍然可以输入比设置更多的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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