@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
} @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if(keyCode == KeyEvent.KEYCODE_HOME){
                  状态栏加图标的操作;
}
return super.onKeyDown(keyCode, event);
}
然后怎么让Home键的功能继续有用啊

解决方案 »

  1.   

    什么意思啊,在什么地方写intent啊,
      

  2.   

    我是这么写的,但是之家了图标,不返回到系统的桌面那里 public boolean onKeyDown(int keyCode, KeyEvent event) {
    if(keyCode == KeyEvent.KEYCODE_HOME){
    NotificationManager nm =     
    (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
    Notification n = new Notification();
    n.icon = R.drawable.golf_ball;
    n.tickerText = "TEST NOTIFICATION";
    n.when = System.currentTimeMillis();
    n.flags = Notification.FLAG_AUTO_CANCEL;
    PendingIntent pi = PendingIntent.getActivity(this,0,new Intent(),0);
    n.setLatestEventInfo(this, "GolfSystem", "GolfSystem正在后台运行", pi);
    nm.notify(1, n);
    return true;
    }
    return super.onKeyDown(keyCode, event);
    }