Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android autocomplete settext in two lines

I am trying to setText("long pile of text") of my AutoCompleteTextView with a line separator. When I insert the text it makes it with horizontal scroll. I want to make it in two lines:

"long pile

of text"

\n\r is working fine for the dropdownlist, but when i click the item, it moves it to the AutoCompleteTextView for which \r\n doesn't work

Things i have tried and failed with:

inserting \n, \r\n, System getProperty("line.separator"), in the string

setting values for autocomplete like

    android:singleLine="false"
    android:lines="2"
    android:minLines="2"
    android:maxLines="4"
    android:scrollHorizontally="false"

this is mine AutoCompleteTextView

    <AutoCompleteTextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/edtxt_ticket_code"
    android:background="@drawable/round_border_gray"
    android:layout_gravity="center_horizontal"
    android:gravity="center|center_vertical|center_horizontal"
    android:hint="Upisi rutu"
    android:lines="2"
    android:minLines="2"
    android:maxLines="4"
    android:scrollHorizontally="false"
    android:paddingLeft="@dimen/edit_text_padding"
    android:paddingRight="@dimen/edit_text_padding"
    android:textColor="@color/gray_main"
    android:textColorHint="@color/gray_light"
    android:textSize="@dimen/text_size_small"/>
like image 222
loop614 Avatar asked Sep 05 '26 14:09

loop614


1 Answers

Just add this android:inputType="textMultiLine"

Finally ,

         android:inputType="textMultiLine"
         android:dropDownHeight="fill_parent"
         android:dropDownWidth="match_parent"

I hope it will helps you

like image 200
IntelliJ Amiya Avatar answered Sep 07 '26 08:09

IntelliJ Amiya