Android的文档介绍了如何禁用搜索搜索功能活动: 公共布尔onSearchRequested(){ 返回false; }
The Android documentation describes how to disable the search the search feature in Activity: public boolean onSearchRequested() { return false; }
这工作正常的搜索按钮,在Nexus One上很短的preSS。 但是,它不会禁用长preSS,仍然触发了一个语音搜索。
This works fine for a short press of the search button on the Nexus One. However, it doesn't disable the long press, which still fires off a voice search.
我如何禁用长preSS语音搜索?
How do I disable the long press Voice search?
谢谢...
我伸出斯坦的答案,只禁用长preSS事件。
I extended Stan's answer to only disable long press events.
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_SEARCH
&& (event.getFlags() & KeyEvent.FLAG_LONG_PRESS) == KeyEvent.FLAG_LONG_PRESS) {
return true;
}
return super.onKeyDown(keyCode, event);
}
上一篇:publishProgress从doInBackground函数里面?函数、里面、publishProgress、doInBackground
下一篇:logcat的错误:" addView(查看,的LayoutParams)不支持适配器视图"在ListView不支持、适配器、视图、错误