0

ハニカムのリッチ通知でクリック可能なボタンを設定する正しい方法は何ですか? ここに表示されているメディア再生ボタンのように (これはミュージック アプリのものだと思います) -

http://androidcommunity.com/google-details-honeycombs-notification-bar-20110202/

Notification.Builder の setSmallIcon() ではありません。この呼び出しにより、ステータス バーでアプリを識別するアイコンが設定されます。

Notification.Builder を見ると、RemoteViews オブジェクトで setContent() を呼び出す必要がありますか?

4

1 に答える 1

4

setOnClickPendingIntentを呼び出して、その中の個々のウィジェットにPendingIntentを指定できるRemoteViewsオブジェクトを作成する必要があります。次に、このRemoteViewsNotificationcontentViewとして設定できます。

RemoteViews layout = new RemoteViews(getPackageName(), R.layout.notification);
notification.contentView = layout;
layout.setOnClickPendingIntent(R.id.notification_button, getDialogPendingIntent("Tapped the 'dialog' button in the notification."));

この完全な例については、ハニカム ギャラリーを参照してください。

于 2011-03-07T16:12:08.170 に答える