Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Min Lines not working when inputType is given in android

Anybody have come across with this situation. I need to show minimum 4 lines for edittext and when minLines given itworks fine But when add inputType tag to it , Min Lines fails..

          <EditText
                android:id="@+id/my_review_review_text"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="5dp"
                android:inputType="textCapSentences|textAutoCorrect"
                android:background="@drawable/rect"
                android:gravity="top|left"
                android:hint="Add a review"
                android:maxLines="5"
                android:minLines="4"
                android:padding="10dp" />

Please correct me if am wrong and provide me a solution....

like image 578
GvSharma Avatar asked Apr 23 '15 13:04

GvSharma


2 Answers

You can use android:inputType="textCapSentences|textMultiLine|textAutoCorrect"

<EditText
        android:id="@+id/notes_box"
        android:inputType="textCapSentences|textMultiLine|textAutoCorrect"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/notes_title"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:padding="9dp"
        android:lines="5"
        android:gravity="top|left"
        android:maxLength="500"
        android:textColor="@color/gray"/>
like image 132
Shailesh Avatar answered Sep 17 '22 17:09

Shailesh


Try it..

      <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine"/>
like image 42
Abhinav singh Avatar answered Sep 17 '22 17:09

Abhinav singh