安卓软键盘的搜索

 //软键盘的搜索按钮
        et_searchinput.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
                if (i == EditorInfo.IME_ACTION_SEARCH || i == EditorInfo.IME_ACTION_UNSPECIFIED) {
                    _initFirstRequest();
                    getData();
                }
                return false;
            }
        });
<tk.lingdang.com.myapplication.ui.ClearEditText
                android:id="@+id/et_searchinput"
                android:drawableLeft="@drawable/i_search_ipt_16_16"
                android:hint="请输入要搜索的商品名称"
                android:paddingLeft="15dp"
                android:layout_marginLeft="5dp"
                android:textSize="16sp"
                android:imeOptions="actionSearch"
                android:maxLines="1"
                android:singleLine="true"
                android:layout_weight="1"
                android:textColorHint="@color/searchInputHintColor"
                android:drawablePadding="10dp"
                android:background="@drawable/searcheditsharp"
                android:layout_width="0dp"
                android:layout_height="35dp" />

 

posted @ 2018-01-27 19:15  layfork  阅读(142)  评论(0编辑  收藏  举报