Reputation: 23
I have a numeric EditText
and when I try to set multiple lines it doesn't work.
This is my code
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="phone" />
Java class
EditText editText = (EditText) view.findViewById(R.id.editText);
editText.setRawInputType(InputType.TYPE_CLASS_PHONE|InputType.TYPE_TEXT_FLAG_MULTI_LINE);
Thanks.
Upvotes: 2
Views: 397
Reputation: 4530
add these lines to your editext xml
android:minLines="2"
android:maxLines="3"
also, don't use android:singleLine="false"
since it is deprecated
Upvotes: 0
Reputation: 18243
Your flags are wrong. From the documentation:
TYPE_TEXT_FLAG_MULTI_LINE
Flag for TYPE_CLASS_TEXT: multiple lines of text can be entered into the field.
So TYPE_TEXT_FLAG_MULTI_LINE
is compatible with TYPE_CLASS_TEXT
but not TYPE_CLASS_PHONE
.
I guess you just can't.
Upvotes: 2