EditText上MAXLINES不工作 - 用户仍然可以输入高于设定多行 [英] EditText maxLines not working - user can still input more lines than set

查看:806
本文介绍了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行,由pressing输入/下一行的关键。如何限制用户输入到行固定数额与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天全站免登陆