捕获Home键按下

在Activity界面重写onAttachedToWindow方法
@Override  
	public void onAttachedToWindow() {
		this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);  
		super.onAttachedToWindow();
	}

switch (keyCode) {
    	case KeyEvent.KEYCODE_HOME:
    		Log.i(TAG,"KEYCODE_HOME");
    		Toast.makeText(Test1Activity.this, "你按下了Home键", Toast.LENGTH_SHORT).show();
    		return true;



捕获Home键按下



你可能感兴趣的:(android,home键)