开发者

Android, how fix the max character length/size of EditText

please guide me, i want to fix the size of EditText..

i want that i can enter only 10 character in EditText, af开发者_如何转开发ter that could not type any more that 10 character...

any method is there?

Thanks in advance..


Add this attribute to EditText

android:maxLength="10"


You can define max length by two ways:

In XML

Define attribute of edittext:

android:maxLength = "10"

In JAVA

Define length through programmatically:

edittext_name.setFilters(new InputFilter[] { new InputFilter.LengthFilter(10) });

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜