当前位置: 代码迷 >> Android >> Android擒获Home键
  详细解决方案

Android擒获Home键

热度:106   发布时间:2016-05-01 19:21:47.0
Android捕获Home键
 @Override  public boolean onKeyDown(int keyCode, KeyEvent event)  {    // TODO Auto-generated method stub    if(KeyEvent.KEYCODE_HOME==keyCode)      android.os.Process.killProcess(android.os.Process.myPid());    return super.onKeyDown(keyCode, event);  }  @Override  public void onAttachedToWindow()  {    // TODO Auto-generated method stub    this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);       super.onAttachedToWindow();  }  加权限禁止Home键  <uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>
?
  相关解决方案