问题
When a user presses the Search hard key on the device, Android shows the Quick Search Bar. How do I disable the Quick Search Bar?
回答1:
In order to completely disabled the Quick Search Bar, override the method onSearchRequested()
and return true unconditionally.
回答2:
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);
}
来源:https://stackoverflow.com/questions/4023749/how-to-disable-qsb