Android EditText pops up a floppy disk and needs a search button and listens

Add two sentences to the layout

android:imeOptions="actionSearch"
android:singleLine="true"

 

 

etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    @Override
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {//floppy disk search key
      ------
            return true;
        }
        return false;
    }
});

Guess you like

Origin blog.csdn.net/zengkai19900512/article/details/84958443