我想在通知抽屉中为我的应用程序设置通知,但只有一个标题(没有正文),这意味着 – 只有一行通知,应该与应用程序图标垂直对齐.
例如,在下面的通知中,我只想保持“Ringer shushed’tr1 19:16”标题,使用相同的字体大小,但垂直居中于左侧的应用程序图标.
这是我创建通知的代码:
NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0,
new Intent(context, MainActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);
PendingIntent deleteIntent = PendingIntent.getService(context, 0,
new Intent(context, GCMIntentService.class)
.setAction(IntentConsts.ACTION_CLEAR_MESSAGE_COUNT), PendingIntent.FLAG_CANCEL_CURRENT);
manager.notify(MMConfig.NTF_ID_GCM, new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.push_icon)
.setContentTitle("My title")
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentIntent(contentIntent)
.setDeleteIntent(deleteIntent)
.build());
现在我成功创建了仅包含标题的通知,但我似乎无法使其与应用程序图标垂直居中.有任何想法吗?