alertDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode,KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_SEARCH) {
return true;
} else {
return false; // 默认返回 false
}
}
});
alertDialog.show();