代码设置: EditText editText = new EditText(this); editText.setImeOptions(EditorInfo.IME_ACTION_SEARCH); editText.setInputType(EditorInfo.TYPE_CLASS_TEXT); xml配置文件: EditText属性设置: android:imeOptions="actionSearch" android:inputType="text"