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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -