Android中使用SearchView时软键盘不支持actionSearch的问题

变态问题常有,今年特别多,,, - - # 今天遇到的这个非处理不可,不然没法在HTC One S使用SearchView,其软键盘不支持action设置。

问题设备:

HTC One S

searchable.xml

<searchable xmlns:android="http://schemas.android.com/apk/res/android"
    android:label="@string/search_label"
    android:hint="@string/search_hint"
    android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
    android:imeOptions="actionSearch"
    android:searchSuggestAuthority="com.xxx.provider.searchsuggestion"
    android:searchSuggestSelection=" ? "  />

解决办法:

SearchView有一个setSubmitButtonEnabled方法,设置为true即可,搜索框不为空就会显示。效果如下图:

在onCreateOptionsMenu中inflate后调用,记得判断API Level。

作者:cnblogs 农民伯伯

查看本栏目更多精彩内容:http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索键盘
, 问题
, 软键盘
, 支持
, searchview hint字体
, qt软键盘android
, android隐藏软键盘
, android软键盘遮挡
, SearchView
, android软键盘
, android实现软键盘
, android软键盘焦点
android显示软键盘
actionbar searchview、webview 软键盘遮挡、webview弹出软键盘、scrollview 软键盘、webview 软键盘不弹出,以便于您获取更多的相关知识。

时间: 2024-08-24 05:27:39

Android中使用SearchView时软键盘不支持actionSearch的问题的相关文章

Android 解决使用SearchView时软键盘不支持actionSearch的问题_Android

前言  变态问题常有,今年特别多,,, - - # 今天遇到的这个非处理不可,不然没法在HTC One S使用SearchView,其软键盘不支持action设置.  正文  问题设备: HTC One S  searchable.xml <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/search_label" andr

Android 解决使用SearchView时软键盘不支持actionSearch的问题

前言 变态问题常有,今年特别多,,, - - # 今天遇到的这个非处理不可,不然没法在HTC One S使用SearchView,其软键盘不支持action设置. 正文 问题设备: HTC One S searchable.xml <searchable xmlns:android="http://schemas.android.com/apk/res/android" android:label="@string/search_label" android:

解析android中隐藏与显示软键盘及不自动弹出键盘的实现方法

1.//隐藏软键盘 ((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(WidgetSearchActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); 2.//显示软键盘,控件ID可以是EditText,TextView ((InputMethodManager)

Android WebView无法弹出软键盘的原因及解决办法_Android

requestFoucs();无效. requestFoucsFromTouch();无效. webview.setTouchListener:无效. 问题所在: 继承WebView时,注意构造方法: public CommonWebView(Context context) { super(context); init(); } public CommonWebView(Context context, AttributeSet attrs) { super(context, attrs);

Android开发之完全隐藏软键盘的方法_Android

隐藏软键盘一直是我头痛的事情,没有找到一种真正能隐藏的方法.点击EditText的时候总是弹出软键盘.-----杯具 杯具(一): InputMethodManager im =(InputMethodManager) mEdit getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); im.hideSoftInputFromWindow(SoftKeyTest.this.getCurrentFocus().getWindowT

Android WebView无法弹出软键盘的原因及解决办法

requestFoucs();无效. requestFoucsFromTouch();无效. webview.setTouchListener:无效. 问题所在: 继承WebView时,注意构造方法: public CommonWebView(Context context) { super(context); init(); } public CommonWebView(Context context, AttributeSet attrs) { super(context, attrs);

Android中InputMethodManager怎么设置输入法键盘为数字键盘?

问题描述 Android中InputMethodManager怎么设置输入法键盘为数字键盘? 2C 现在需要强制弹出安卓系统键盘,并且是数字键盘,不是字母键盘.下面是强制弹出系统键盘代码(弹出来的是字母键盘) InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(0 InputMethodManager.HIDE_NOT_A

Android开发之完全隐藏软键盘的方法

隐藏软键盘一直是我头痛的事情,没有找到一种真正能隐藏的方法.点击EditText的时候总是弹出软键盘.-----杯具 杯具(一): InputMethodManager im =(InputMethodManager) mEdit getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); im.hideSoftInputFromWindow(SoftKeyTest.this.getCurrentFocus().getWindowT

Android App实现监听软键盘按键的三种方式

前言: 我们在Android手机上面有时候会遇到监听手机软键盘按键的时候,例如:我们在浏览器输入url完毕后可以点击软键盘右下角的"Go"按键加载url页面:在点击搜索框的时候,点击右下角的search符号键可以进行搜索:或者在全部数据输入完毕后,点击右下角的"done"就马上进行下一步操作. 效果图: function 1: 重写Activity的dispatchKeyEvent(KeyEvent event)方法,在其中监听KeyEventKey.KEYCODE