When a user p开发者_运维百科resses the Search hard key on the device, Android shows the Quick Search Bar. How do I disable the Quick Search Bar?
override onKeyDown in your activity:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_SEARCH) {
return true;
} else return super.onKeyDown(keyCode, event);
}
In order to completely disabled the Quick Search Bar, override the method onSearchRequested()
and return true unconditionally.
精彩评论