简体   繁体   English

通知操作按钮上升

[英]Notification action buttons appereance

How to make the notification buttons to appear as they are supposed to (like on the 2nd notification on the image below)? 如何使通知按钮按预期显示(如下图中的第二个通知)?

This is my code: 这是我的代码:

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();

通知

看起来我必须将android:targetSdkVersion设置为11或更高

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM