2017-02-04 9 views
-1

Я пытаюсь реализовать AutoCompleteTextView с многострочным текстом и с нажатой клавиатурой. Но кнопка done не отображается на клавиатуре (показывает кнопку ввода). То же самое, что я пробовал с android:singleLine="true", и текст поставляется в одной строке с кнопкой «Готово».AutoCompleteTextView с нажатой клавиатурой и maxLines

<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" /> 
+0

добавить inputtype в XML –

+0

Возможный дубликат [Закончили не работает в softKeyboard в автозаполнения TextView в Android] (HTTP: // StackOverflow .com/questions/3109516/done-is-not-work-in-softkeyboard-in-autocomplete-textview-in-android) –

+1

Один вопрос 4 u !, вы хотите 4 строки с сделанным imeOption, как вы нажмете enter для следующая строка? –

ответ

0

Добавить android:imeActionLabel="Done" в свой xml код

<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" /> 
+0

Пробовал этот не работал !!! Он показывает кнопку ввода после 4-х строк – Pratik

+0

Обновлен ответ. –

0

андроида: inputType = "текст" работает.

<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" /> 

Набор HorizontalScrolling и MaxLines

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

Он работает