android - EditText word wrap -
android - EditText word wrap -
i have layout:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:padding="@dimen/activity_horizontal_margin" > <linearlayout android:id="@+id/header" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <edittext android:id="@+id/edittext" android:layout_width="match_parent" android:layout_height="wrap_content" /> </linearlayout>
what want when user enters more text fits single line, edittext
wraps line, increases height automatically , shows not fitting text in next line. edittext
should not scrollable horizontally.
i read lots of questions related this, none of them helped. edittext
above not wrap lines, , can scrolled horizontally. tested on android 4.2 , 4.4.
edit: added finish layout.
edit2:
sorry, fault. alter input type programatically in code:
medittext.setinputtype(minputtypes.get(question.gettype()));
so line, have overriden input type xml. modified code, , multiline
input type indeed works.
i have removed unnecessary attributes , set required attribute android:maxlines="20",
so looks this,
<edittext android:id="@+id/edittext" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputtype="textmultiline" android:maxlines="20" />
android android-edittext textview
Comments
Post a Comment