android - EditText height for fit a certain numbers of character -
there's way set height of edittext contains @ least n character ?
there number of ways can limit edittext number of characters within multiple line well.
firstly, set in .xml:
android:inputtype="textmultiline" android:maxlength="n"
secondly, can use way around reach goal. here is. implement textwatcher let user enter 'n' characters. whenever user enters 'n' characters, set edittext non-editable. , set onfocuschangelistener it.
edittext edittext = (edittext)findviewbyid(r.id.entry); edittext.setfilters(new inputfilter[]{new inputfilter.lengthfilter(20)});
for more details , explanation of textwatcher, can have number of input characters.
for more manipulation on multiple lines. can set number of lines way, after have set textmultiline, can use or of below:
android:lines="8" android:minlines="6" android:maxlines="10" android:scrollbars="vertical/horizontal"
Comments
Post a Comment