屏蔽返回键和HOMe键

/**
   * 屏蔽返回键
   */
 @Override
 public boolean onKeyDown(int keyCode, KeyEvent event) {
  switch (keyCode) {
  case KeyEvent.KEYCODE_HOME:
   return true;
  case KeyEvent.KEYCODE_BACK:
   return true;
  }
  return super.onKeyDown(keyCode, event);
 }

/**
 * 屏蔽Home键
 */
 @Override
 public void onAttachedToWindow() {
  getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
  super.onAttachedToWindow();
 }

posted @ 2013-01-17 16:24  疯子FK  阅读(173)  评论(0编辑  收藏  举报