嗨,伙计们,我调用方法onKeyDown,我的应用程序关闭,但没有让我回复错误,这是我的代码:
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK)
{
if (expList.getVisibility() == View.VISIBLE){
expList.setVisibility(View.INVISIBLE);
}else{
//
}
}
return super.onKeyDown(keyCode, event);
}
答案 0 :(得分:1)
您的应用关闭,因为您调用方法“super.onKeyDown(keycode,event);”
尝试使用返回false,如下所示:
public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (expList.getVisibility() == View.VISIBLE){ expList.setVisibility(View.INVISIBLE); }else{ // } } return false; }