0

I am trying to implement AutoCompleteTextView with multiline text and with keyboard done button. But done button does not show on keyboard (shows enter button). Same thing i have tried with android:singleLine="true" and text comes in single line with done button.

 <AutoCompleteTextView
                        android:id="@+id/txtVillageName"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@drawable/edt_border"
                        android:cursorVisible="true"
                        android:maxLines="4"
                        android:hint="Enter your location"
                        android:imeOptions="actionDone"
                        android:textColor="@color/text_color"
                        android:textColorHint="@color/lblColor"
                        android:textSize="@dimen/text_size_large" />
Pratik
  • 452
  • 4
  • 17

2 Answers2

1

Add android:imeActionLabel="Done" into your xml code

<AutoCompleteTextView
        android:id="@+id/txtVillageName"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:cursorVisible="true"
        android:hint="Enter your location"
        android:imeOptions="actionDone"
        android:imeActionLabel="Done"
        android:singleLine="true" />
Mayur Gangurde
  • 1,552
  • 12
  • 22
1

android:inputType="text" works.

<AutoCompleteTextView
                        android:id="@+id/txtVillageName"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:cursorVisible="true"
                        android:hint="@string/location_hint"
                        android:imeOptions="actionDone"
                        android:inputType="text"
                        android:textColor="@color/text_color"
                        android:textColorHint="@color/lblColor"
                        android:textSize="@dimen/text_size_large" />

Set HorizontalScrolling and MaxLines

mAutocompleteTextView.setHorizontallyScrolling(false);
mAutocompleteTextView.setMaxLines(Integer.MAX_VALUE);

It works

Pratik
  • 452
  • 4
  • 17