Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android moves EditText's content to the next line automatically while typing

Tags:

android

I need my EditText component to move the text to the next line when it reaches the end of the row.

And does anyone know how to prevent EditText from expanding vertically when it's filled with text? Instead EditText should scroll vertically. Is there a way to make it without fixing the size of EditText?

I searched the Web for relevant information but haven't found the answers.

like image 993
user1680286 Avatar asked May 24 '13 10:05

user1680286


People also ask

How to move edittext layout just above soft keyboard in Android?

So by using android:windowSoftInputMode=”stateVisible|adjustPan” code inside your AndroidManifest.xml file will enable the automatically activity screen movement while user starts typing on EditText. So here is the complete step by step tutorial for Move EditText layout just above soft keyboard when it shows in android.

How to edit text in Android Studio?

Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/Activity_main.xml. In the above code, we have given on Edit Text.

How to enable activity screen movement while user starts typing on edittext?

So by using android:windowSoftInputMode=”stateVisible|adjustPan” code inside your AndroidManifest.xml file will enable the automatically activity screen movement while user starts typing on EditText.

How to implement edittext widget in Android?

The main layout of the application contains the EditText Widget and two buttons. To implement the UI invoke the following code inside the activity_main.xml file. To get an idea about how the basic EditText in android looks like. 1. Input Type for the EditText This is one of the attributes which is needed to be specified under the EditText widget.


1 Answers

Put this in XML:

Use maxHeight for EditText expand vertically problem and android:inputType="textMultiLine" for shifting text to next line.

               <EditText
                android:id="@+id/edit_text"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:maxHeight="140dp"
                android:scrollbars="vertical"
                android:inputType="textMultiLine"
                >
               </EditText>
like image 125
Akhilesh Mani Avatar answered Sep 17 '22 18:09

Akhilesh Mani