在Android中覆写一下两个方法就可以捕获Home见键盘,不过,此方法只限2.x版本的SDK
- @Override
- public void onAttachedToWindow()
- {
- this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
- super.onAttachedToWindow();
- }
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- if(keyCode==KeyEvent.KEYCODE_HOME){
- Log.i("key", "home is press ");
- finish();
- }
- return super.onKeyUp(keyCode, event);
- }