我正在尝试借助带有按钮的远程视图创建自定义通知。我想为此按钮编写 onclick 侦听器,但问题是通知容器正在捕获触摸事件并且未单击按钮。我的问题是有什么方法可以禁用此通知并让按钮被点击。我的代码如下所示:
Notification notification = new Notification(R.drawable.applogo,
"Apps activated", System.currentTimeMillis());
Intent notificationIntent = new Intent(getBaseContext(), AppsActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(getBaseContext(),
0, notificationIntent , 0);
notification.contentIntent = pendingIntent;
//Remoteview and intent for my button
RemoteViews remoteView = new RemoteViews(getBaseContext().getPackageName(),
R.layout.customnotification);
Intent mIntent = getPackageManager().getLaunchIntentForPackage(c.getString(1));//starting some application through package
PendingIntent pintent = PendingIntent.getActivity(this, 0,
mIntent, 0);
remoteView.setOnClickPendingIntent(R.id.button1,
pintent);
notification.contentView = remoteView;
notificationManager.notify(CUSTOM_NOTIFICATION_ID, notification);
我正在研究 api 7。谢谢