Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android EditText keyboard newline not working (only on input view)

Tags:

android

In the affirmation text field I press the newline button and it puts spaces. However after I click done the field actually has the correct new lines (second screen capture).

Its not a problem with the device as it works correctly for the compose mail filed in the gmail app. Which is how I would like this to work.

W

enter image description here

<TextView
        android:inputType="textMultiLine"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dip"
        android:text="@string/edit_affimation"
/>
<EditText
android:id="@+id/affText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="18sp"
android:singleLine="false"
>
</EditText>
like image 967
Jase Whatson Avatar asked Feb 21 '11 00:02

Jase Whatson


People also ask

How do you go to the next line in EditText?

ADD this to your EditText xml code This will automatically moves your text to next line while entering data. this doesn't add \n chars to the string. just breaks the line in the EditText view, which isn't what the OP is asking for.

How to set input type in EditText android?

To get the input type use getInputType() . int inputTypeValue = editText. getInputType(); The InputType values are defined (in hexadecimal) in the documentation.

How do I get my keyboard to only show numbers on android?

To get the number pad, and tap the special character key in the lower left corner of the keyboard. Then, tap the key just to the left of the spacebar with the numbers 1-4 in a little square.

What is inputType in android?

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.


1 Answers

Figured it out

<EditText
    android:inputType="textMultiLine"
    android:id="@+id/affText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text=""
    android:textSize="18sp"
    android:singleLine="false">
</EditText>

Add following attribute:

android:inputType="textMultiLine"
like image 150
Jase Whatson Avatar answered Oct 08 '22 10:10

Jase Whatson