Android 捕捉HOME键

 @Override

	    public boolean onKeyDown(int keyCode, KeyEvent event) {

	        if (keyCode == KeyEvent.KEYCODE_HOME) {

	            return true;

	        } else {

	            return super.onKeyDown(keyCode, event);

	        }

	    }

	

	@Override

    public void onAttachedToWindow() {

        this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);

        super.onAttachedToWindow();

    }

	


你可能感兴趣的:(android)