Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make my EditText five lines high without using android:inputType="textMultiLine"?

I want to have a EditText view that is five lines high. I want it five lines high for visual appeal reasons only (so that it does not appear cramped). The code below does not work, the EditText appears only one line high.

I have tried multilinetext and it works visually, however I want to abandon it as I want the virtual keyboard to say "Next" (rather than have the enter key that is automatically provided with multiline text)

How can I make my EditText box bigger? Alternatively, how can I use the imeOption "actionNext" with multiline text?

This code does not work...

<EditText
        android:id="@+id/etEdit"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:inputType="text"
        android:lines="5"  //this has no effect!
        android:imeOptions="actionNext"
        style="@style/dialogInput" />  
like image 490
Mel Avatar asked Oct 03 '11 03:10

Mel


People also ask

Which allows editing of multiple lines of text?

Just add this android:inputType="textMultiLine" in XML file on relevant field. Save this answer.

What is the EditText attribute android inputType used for?

The android:inputType attribute allows you to specify various behaviors for the input method. Most importantly, if your text field is intended for basic text input (such as for a text message), you should enable auto spelling correction with the "textAutoCorrect" value.

How do I change my EditText value?

Set the Text of Android EditText In android, we can set the text of EditText control either while declaring it in Layout file or by using setText() method in Activity file. Following is the example to set the text of TextView control while declaring it in XML Layout file.


2 Answers

Change:

android:inputType="text"

to:

android:inputType="textMultiLine"

Works for me!

like image 181
keynetic Avatar answered Oct 12 '22 05:10

keynetic


<EditText
        android:id="@+id/etEdit"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="top"
        android:inputType="text"
        android:lines="5"  //this has no effect!
        android:imeOptions="actionNext"
        style="@style/dialogInput"
        android:singleLine="false" />  

android:singleLine="false" will make editText to support multiple lines
like image 34
jazz Avatar answered Oct 12 '22 03:10

jazz