用過就忘,軟鍵盤搜索按鈕

AutoCompleteTextView設置鍵盤搜索按鈕android

<AutoCompleteTextView

   android:id="@+id/harSearch"
   android:layout_width="0dp"
   android:singleLine="true"
   android:drawableLeft="@drawable/sousuo"
   android:hint="搜索"
   android:imeOptions="actionSearch"
   android:layout_weight="10"
   android:layout_height="wrap_content"
   android:completionThreshold="1"

   />
android:imeOptions="actionSearch" //設置鍵盤搜索按鈕
android:singleLine="true" //設置單行,不設置則顯示回行按鈕。找不到搜索按鈕= =

後臺處理
spa

.setOnEditorActionListener(TextView.OnEditorActionListener() {
    onEditorAction(TextView v, actionId, KeyEvent event) {
        (actionId == EditorInfo.) {

            .clearFocus();
            searchListView();
            ;
        }
        ;
    }
相關文章
相關標籤/搜索