2017-02-04 19 views
-1

複数行のテキストとキーボードで完了ボタンでAutoCompleteTextViewを実装しようとしています。しかし完了ボタンはキーボードに表示されません(入力ボタンを表示します)。同じことを私はandroid:singleLine="true"で試して、テキストは完了ボタンで1行になります。キーボードで完了したボタンとmaxLinesを持つAutoCompleteTextView

<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

は、(HTTPの –

+0

可能な重複[完了がアンドロイドでオートコンプリートのTextViewにsoftKeyboardで働いていません] XMLでinputtypeを追加作品:// stackoverflowの.com/questions/3109516/done-is-working-in-softkeyboard-in-autocomplete-textview-in-android) –

+1

1つの質問4あなた!次の行? –

答えて

0

あなた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

アンドロイドにandroid:imeActionLabel="Done"を追加します。inputType = "text" の作品。

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

設定Horizo​​ntalScrollingとMAXLINES

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

それは

関連する問題