5
如何使通知按钮显示为应该显示的状态(如下图中的第二个通知)?通知操作按钮appereance
这是我的代码:
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();
有没有什么办法对我们这些做谁必须定位较低的SDK版本?当然,动作按钮不会在Android 2.x上显示,但我想在显示时适当地设计它们的样式。 – 2013-02-01 22:48:05
您应该始终针对最新的API。 Lint将负责兼容性检查,并在您使用不在2.2版本的API时通知您。 – martinpelant 2013-02-02 15:48:29