老师返回怎么改?
//d打开菜单 public void openMenu() { if(isOpen) return; this.smoothScrollTo(0,0); isOpen=true; } //关闭菜单 public void closeMenu() { if(!isOpen)return; this.smoothScrollTo(mMenuWidth,0); isOpen=false; } //切换菜单 @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode==KeyEvent.KEYCODE_BACK) { closeMenu(); } return super.onKeyDown(keyCode, event); /* return isOpen=false;*/ } public void toggle(){ if(isOpen) { closeMenu(); }else { openMenu(); } }
请问如何监听手机返回按键,,将菜单栏关闭,而不是直接退出程序。