Question

I am using one autocomplete. I want to show this autocomplete as a multiline. I don't want to show dropdown as a multi line but i want to show textbox as a multi line.

I also use multiline attribute in .xml file but it's showing nextline key on keyboard and i don't want to use user to press this and go on next line.

What happening now

I am typing something in textbox after finishing space it's scrolling horizontally. and show all text in one line.

What i want

Suppose user typing and after finishing space of textbox then automatically cursor will goes on next line so user can see all text at one time without scrolling horizontally.

Here is my code.

<AutoCompleteTextView
                android:id="@+id/txtTags"
                android:layout_width="fill_parent"
                android:layout_height="44dip"
                android:layout_marginLeft="12dip"
                android:layout_marginRight="12dip"
                android:background="@drawable/borderforloginedittext"
                android:gravity="center_vertical"
                android:hint="eg: Breakfast, spicy, italian "
                android:inputType="textPersonName|textImeMultiLine"
                android:imeOptions="actionSearch"
                android:paddingLeft="70dp"
                android:scrollHorizontally="false"
                android:verticalScrollbarPosition="right"
                 android:dropDownHeight="fill_parent"
                android:dropDownWidth="match_parent"
                android:textColor="#333333"
                android:textColorHint="#999999"
                android:textSize="16sp" >
            </AutoCompleteTextView>    

I need impeoption as an actionsearch so user can press search key of keyboard. That's why i can't use textmultiline because it replace search key with next line key.

Please give some reference or hint.

Was it helpful?

Solution

I didn't find any answer on this. Because i want to use imeoption as actionSearch and then i want my autocomplete to behave like multiline EditText.

So, I remove actionsearch as an ime option and place multiline. It's not what i want but still satisfy atleast achieve 50%.

<AutoCompleteTextView
    android:id="@+id/txtTags"
    android:layout_width="fill_parent"
    android:layout_height="44dip"
    android:layout_marginLeft="12dip"
    android:layout_marginRight="12dip"
    android:background="@drawable/borderforloginedittext"
    android:hint="eg: Breakfast, spicy, italian "
    android:inputType="textPersonName|textMultiLine"
    android:paddingLeft="70dp"                
    android:dropDownHeight="fill_parent"
    android:dropDownWidth="match_parent"
    android:textColor="#333333"
    android:textColorHint="#999999"
    android:textSize="16sp" >
</AutoCompleteTextView>    

This code provide me one option to use multiline.

OTHER TIPS

do the following change in your xml.

<AutoCompleteTextView
            android:id="@+id/txtTags"
    <!--remove below width as fill_parent and set fixed width as per your need-->
            android:layout_width="fill_parent"
            android:layout_height="44dip"
            android:layout_marginLeft="12dip"
            android:layout_marginRight="12dip"
            android:background="@drawable/borderforloginedittext"
            android:gravity="center_vertical"
            android:hint="eg: Breakfast, spicy, italian "
  <!-- please replace textImeMultiLine with textMultiLine.--> 
            android:inputType="textPersonName|textImeMultiLine"
            android:imeOptions="actionSearch"
            android:paddingLeft="70dp"
            android:scrollHorizontally="false"
            android:verticalScrollbarPosition="right"
             android:dropDownHeight="fill_parent"
            android:dropDownWidth="match_parent"
            android:textColor="#333333"
            android:textColorHint="#999999"
            android:textSize="16sp" >
          </AutoCompleteTextView>

Its so simple, You just need to set

android:singleLine="false"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top