5

通知ボタンを想定どおりに表示するにはどうすればよいですか (下の画像の 2 番目の通知のように)。

これは私のコードです:

Notification.Builder nb = new Notification.Builder(mCtx);
    nb.setTicker("DATART");
    nb.setSmallIcon(R.drawable.ic_menu_info_details_select);
    nb.setContentText("DATART text");
    nb.setContentTitle(mCtx.getString(R.string.app_name));
    nb.setContentIntent(getClickIntent());
    nb.setAutoCancel(true);
    nb.setDefaults(Notification.DEFAULT_VIBRATE | Notification.DEFAULT_SOUND);
    nb.setLights(LED, LEDON, LEDOFF);
    nb.addAction(android.R.drawable.ic_btn_speak_now, "Prihodit", PendingIntent.getActivity(mCtx, 0, new Intent(mCtx, AuctionProductDetail.class), 0));
    nb.addAction(android.R.drawable.ic_dialog_map, "Mapa", PendingIntent.getActivity(mCtx, 0, new Intent(mCtx, AuctionProductDetail.class), 0));
    return nb.build();

通知

4

1 に答える 1

2

Android:targetSdkVersion を 11 以上に設定する必要があるようです

于 2012-07-26T12:08:40.927 に答える