代码如下:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
if(KeyEvent.KEYCODE_HOME==keyCode)
android.os.Process.killProcess(android.os.Process.myPid());
return super.onKeyDown(keyCode, event);
}
@Override
public void onAttachedToWindow(){
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
super.onAttachedToWindow();
}
加权限禁止Home键
代码如下:
uses-permission android:name="android.permission.DISABLE_KEYGUARD"/uses-permission
猜你喜欢