解决方案 »

  1.   

    应该是被notification截获了按钮单击事件。你可以查看notification
      

  2.   

    你可以设置点击按钮后,发送一个广播,然后在你需要处理这个动作的类或者activity里监听这个广播,然后进行相应的处理。
           // 比如有个ID为bt_cancle的按钮,点击后发送一个广播,则在创建notification时参考下面的代码添加你的按钮事件
            Intent cancelIntent = new Intent(NOTIFY_CANCEL);
            cancelIntent.putExtra(INTENT_URL, url);
            Bundle bundleCancel = new Bundle();
            bundleCancel.putInt(INTENT_FLAG, notifyflag);
            cancelIntent.putExtras(bundleCancel);
            PendingIntent cancelPendIntent = PendingIntent.getBroadcast(this, notifyflag,
                    cancelIntent, 0);
            mRemoteViews.setOnClickPendingIntent(R.id.bt_cancle, cancelPendIntent);
      

  3.   

    这里面的 mRemoteViews 就是你的通知栏里那个UI界面的布局,例如:RemoteViews mRemoteViews = new RemoteViews(getPackageName(),
                    R.layout.notification_download);
      

  4.   

    Notification好多版本,
    原始版本Notification
    3.0通过Notification.Builder 创建;
    4.0通过NotificationCompat.Builder创建4.0以上版本才支持Button