开发者

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

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.

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

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

<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>


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"


You can also do it programmatically:

Editext txt = (EditText) findViewById(R.id.affText);
txt.setRawInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜