How to disable QSB..?

混江龙づ霸主 提交于 2019-12-11 07:04:36

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!